使用SSH将文件从服务器复制到本地计算机

编程入门 行业动态 更新时间:2024-10-27 08:29:29
本文介绍了使用SSH将文件从服务器复制到本地计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我无法使用 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 username@host:/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将文件从服务器复制到本地计算机

本文发布于:2023-10-17 02:49:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1499550.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   文件   计算机   SSH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!