小智 27
这与编程无关,但您可以使用 scp 来执行此操作。
scp file.zip remote-box-name:/path/to/destination/file.zip
Run Code Online (Sandbox Code Playgroud)
如果您在远程盒子上的用户名不同,则需要为其添加前缀:
scp file.zip yourusername@remotebox:/path/to/destination/file.zip
Run Code Online (Sandbox Code Playgroud)
要检索文件,您可以这样做:
scp remotebox:/path/to/destination/file.zip file.zip
Run Code Online (Sandbox Code Playgroud)
在机器 A 上,打开两个终端窗口
在机器 A 上,通过 ssh 连接到机器 B。环顾四周,找到机器 B 上要复制的文件的路径
在机器 A 上,第二个终端窗口类型:
scp yourusername@remotebox:/path/to/destination/file.zip /home/me/Desktop
该文件应从机器 B 复制到机器 A,复制到 /home/me/Desktop 文件夹(如果该文件夹存在于机器 A 上)
您不能复制现有的 ssh 会话。您需要创建第二个会话。正如其他人所指出的:
yourusername
用于机器 B,仅当机器 B 的用户名与机器 A 上的用户名不同时才需要
remotebox
可以是可解析的名称或 IP 地址
备择方案: