问题描述
我无法使用 SSH 从远程服务器复制文件.使用 PuTTY 我使用 SSH 登录到服务器.找到要复制到计算机的文件后,我使用以下命令:
I am having trouble copying files from a remote server using SSH. Using PuTTY I log in to the server using SSH. Once I find the file I would like to copy over to my computer, I use the command:
scp [email protected]:/dir/of/file.txt \local\dir\
看起来它成功了,但它最终只会在远程目录 /dir/of/
中创建一个标记为localdir"的新文件夹.
It looks like it was successful, but it only ends up creating a new folder labeled 'localdir' in the remote directory /dir/of/
.
如何通过 SSH 将文件复制到本地计算机?
How can I copy the file to my local computer over SSH?
推荐答案
这取决于您的本地操作系统是什么.
It depends on what your local OS is.
如果您的本地操作系统是类 Unix,请尝试:
If your local OS is Unix-like, then try:
scp username@remoteHost:/remote/dir/file.txt /local/dir/
如果您的本地操作系统是 Windows,那么您应该使用 pscp.exe
实用程序.例如,下面的命令将从远程下载 file.txt 到本地机器的 D:
磁盘.
If your local OS is Windows ,then you should use pscp.exe
utility.For example, below command will download file.txt from remote to D:
disk of local machine.
pscp.exe username@remoteHost:/remote/dir/file.txt d:\
您的本地操作系统似乎是 Unix,因此请尝试使用前者.
It seems your Local OS is Unix, so try the former one.
对于那些不知道 pscp.exe
是什么并且不知道它在哪里的人,您可以随时转到 putty
官方网站下载.然后打开一个CMD提示,进入你放置的pscp.exe目录.然后执行上面提供的命令
For those who don't know what pscp.exe
is and don't know where it is, you can always go to putty
official website to download it. And then open a CMD prompt, go to the pscp.exe directory where you put it. Then execute the command as provided above
这篇关于使用SSH将文件从服务器复制到本地计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!