How do I copy a file from a remote server to my local Windows system using a Putty session?
Asked
Active
Viewed 3e+01k times
98
-
1One solution is to configure port forwarding with putty (e.g. 8080 to 8080), then inside your SSH session run `python -m SimpleHTTPServer 8080`. Then locally open a browser and go to `localhost:8080`. – falsePockets Dec 13 '19 at 06:12
2 Answers
168
It worked using PSCP. Instructions:
- Download PSCP.EXE from Putty download page
- Open command prompt and type
set PATH=<path to the pscp.exe file>
- In command prompt point to the location of the pscp.exe using cd command
- Type
pscp
use the following command to copy file form remote server to the local system
pscp [options] [user@]host:source target
So to copy the file /etc/hosts
from the server example.com
as user fred
to the file
c:\temp\example-hosts.txt
, you would type:
pscp fred@example.com:/etc/hosts c:\temp\example-hosts.txt
-
6if you need to connect to a specific port then use the following. pscp -P
userid@:path/source_file_name c:\path\destination – Swamy Nov 12 '14 at 07:18 -
5To authenticate with ssh key use `-i C:\path\id_rsa.ppk` [link](https://verrytechnical.com/using-pscp-with-ssh-key-pair-authentication-to-transfer-files/) – Nicolas Sep 25 '18 at 12:32
-
1It is handy to save the session in putty and use that session so no hassle of authentication within pscp. `pscp sessionname:source target` , where sessionname is replaced by the name of your saved session in putty. – Bikash kharel Dec 18 '18 at 10:08
-
So it's not possible to do this inside the putty window, it has to be used in CMD? – Herman Toothrot Mar 08 '19 at 05:50
-
3@HermanToothrot it seems like it. you need to run it separately from putty. Also, i think i should point out that you need double-quotes on the Windows path if you specify a full path like this: `pscp pi@192.168.0.123:/folder/myfile.txt "D:\Temporary\\myfile.txt"` alternatively, you could always use WinSCP which is way easier to use because of the GUI – mickeymicks Dec 16 '19 at 10:51
-
2What's the point of obliterating your `PATH` settings if you're just going to `cd` into `pscp`'s folder anyway? Why even include step 4 (which does nothing)? These instructions are mess. – pbarney Aug 07 '20 at 17:18
97
One of the putty tools is pscp.exe; it will allow you to copy files from your remote host.

mah
- 39,056
- 9
- 76
- 93