如何使用 SSH 从我的服务器下载文件(在 Windows 上使用 PuTTY) [英] How to download a file from my server using SSH (using PuTTY on Windows)

查看:111
本文介绍了如何使用 SSH 从我的服务器下载文件(在 Windows 上使用 PuTTY)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将文件从我的服务器下载到我的计算机时,它实际上是将文件下载到服务器上.

When I try downloading a file from my server onto my computer, it actually downloads the file onto the server.

(请注意,在输入此命令之前,我已经通过 SSH 连接到我的服务器.我在 YouTube 上观看了教程,人们正在使用他们的终端而没有通过 SSH 连接到任何特定服务器,但是我认为我无法做到这一点Windows 上的 PuTTY?)

(Note I am already SSH'd into my server before typing this command. I've watched tutorials on YouTube and people are using their terminal without SSHing into any particular server, however I don't think I can do this with PuTTY on Windows?)

scp -r -P2222 kwazy@mywebsite.com:/home2/kwazy/www/utrecht-connected.nl ~/Desktop/

问题是我指定下载文件的位置仅为 ~/Desktop/

The problem is that I am specifying the location to download the file as only ~/Desktop/

这会在我的服务器中创建一个名为 Desktop 的文件夹,而不是将文件复制到我的本地桌面上.

This creates a folder called Desktop in my server, instead of copying the files onto my local desktop.

非常感谢您的帮助.

更新:

我可以在 Linux 上使用这个命令.

I am able to use this command on Linux.

我已成功将该文件夹下载到我的桌​​面上:

I have successfully download the folder onto my desktop:

我仍然需要深入了解如何在 Windows 机器上执行此操作.

I still need insight onto how I can do this on a Windows machine.

推荐答案

无法从 PuTTY 窗口中打开的 SSH 会话启动文件传输回本地 Windows 或从本地 Windows 传输文件.

There's no way to initiate a file transfer back to/from local Windows from a SSH session opened in PuTTY window.

虽然 PuTTY 支持连接共享.

Though PuTTY supports connection-sharing.

虽然您仍然需要运行兼容的文件传输客户端 (<代码>pscppsftp),不需要新的登录,它会自动(如果启用)使用现有的 PuTTY 会话.

While you still need to run a compatible file transfer client (pscp or psftp), no new login is required, it automatically (if enabled) makes use of an existing PuTTY session.

要启用共享,请参阅:
在 PuTTY 工具之间共享 SSH 连接.

To enable the sharing see:
Sharing an SSH connection between PuTTY tools.

即使没有连接共享,您仍然可以从 Windows 命令行使用 psftppscp.

Even without connection-sharing, you can still use the psftp or pscp from Windows command line.

请参阅如何使用 PSCP 将文件从 Unix 机器复制到 Windows 机器......?

注意 scp 是 OpenSSH 程序.它主要是 *nix 程序,但您可以通过 适用于 Linux 的 Windows 子系统 或从 Win32-OpenSSH 获取 Windows 版本(它已经内置在最新版本中)Windows 10).

Note that the scp is OpenSSH program. It's primarily *nix program, but you can run it via Windows Subsystem for Linux or get a Windows build from Win32-OpenSSH (it is already built-in in the latest versions of Windows 10).

如果您真的想将文件下载到本地桌面,则必须将目标路径指定为 %USERPROFILE%Desktop(通常解析为类似 C:用户用户名桌面).

If you really want to download the files to a local desktop, you have to specify a target path as %USERPROFILE%Desktop (what typically resolves to a path like C:UsersusernameDesktop).

另一种方法是使用 WinSCP,一个 GUI SFTP/SCP 客户端.在浏览远程站点时,您可以随时使用 在 PuTTY 中打开 命令将 SSH 终端打开到同一站点.
请参阅在 PuTTY 中打开会话.

Alternative way is to use WinSCP, a GUI SFTP/SCP client. While you browse the remote site, you can anytime open SSH terminal to the same site using Open in PuTTY command.
See Opening Session in PuTTY.

通过额外的设置,您甚至可以让 PuTTY 自动导航到您使用 WinSCP 浏览的同一目录.
请参阅在同一目录中打开 PuTTY.

With an additional setup, you can even make PuTTY automatically navigate to the same directory you are browsing with WinSCP.
See Opening PuTTY in the same directory.

(我是 WinSCP 的作者)

这篇关于如何使用 SSH 从我的服务器下载文件(在 Windows 上使用 PuTTY)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆