Pergunta

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

(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.example:/home2/kwazy/www/utrecht-connected.nl ~/Desktop/

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

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


I am able to use this command on Linux.

I have successfully download the folder onto my desktop:

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

Nenhuma solução correta

Outras dicas

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

Though PuTTY supports connection-sharing.

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.

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


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

See How to use PSCP to copy file from Unix machine to Windows machine ...?

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).


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:\Users\username\Desktop).


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.

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.

(I'm the author of WinSCP)

try this scp -r -P2222 kwazy@mywebsite.example:/home2/kwazy/www/utrecht-connected.nl /Desktop

Another easier option if you're going to be pulling files left and right is to just use an SFTP client like WinSCP. Then you're not typing out 100 characters every time you want to pull something, just drag and drop.

Just noticed /Desktop probably isn't where you're looking to download the file to. Should be something like C:\Users\you\Desktop

OpenSSH has been added to Windows as of autumn 2018, and is included in Windows 10 and Windows Server 2019.

So you can use it in command prompt or power shell like bellow.

C:\Users\Parsa>scp parsa@192.168.100.11:/etc/cassandra/cassandra.yaml F:\Temporary
parsa@192.168.100.11's password:
cassandra.yaml                                  100%   66KB  71.3KB/s   00:00

C:\Users\Parsa>

(I know this question is pretty old now but this can be helpful for newcomers to this question)

if you install git with git bash, you get SCP available on windows.

If your server have a http service you can compress your directory and download the compressed file.

Compress:

tar -zcvf archive-name.tar.gz -C directory-name .

Download throught your browser:

http://the-server-ip/archive-name.tar.gz

If you don't have direct access to the server ip, do a ssh tunnel throught putty, and forward the 80 port in some local port, and you can download the file.

You can use WinSCP : https://winscp.net/eng/download.php

Or MobaXterm : https://mobaxterm.mobatek.net/download.html

It feels like FTP client. Also I don't remember setting up anything on my machine for this. It just fresh install and install SSH server (IDK if it matters though). enter image description here

enter image description here

For MobaXterm :

enter image description here

You can use the WinSPC program. Its access to any server is pretty easy. The program gives its guide too. I hope it's helpfull.

If you need something with GUI you can use FileZilla. it support SFTP.

It's perfectly working with ssh and you can even edit files and it will automatically upload the changes.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top