You are here

Tranferring a file using PuTTY's pscp

Submitted by Druss on Mon, 2013-06-24 13:14

Instead of having to look up the exact syntax for pscp every time, here's a list of examples for future reference. In these examples, I'm transferring a file ( from a Windows host to a Linux server (with the destination path of /home/druss/Desktop/).

"C:\Program Files (x86)\PuTTY\pscp.exe" -scp -P 2134 -pw mypassword

You can leave out the -pw SSH password switch if you like, but on my laptop, the password prompt is not displayed immediately. While I could simply press the Enter key once to trigger it, the option of including the password in the command itself is sometimes easier (if insecure).

The -P 2134 is, of course, the port number of the SSH server,

That said, if you ever run into annoyances like my password issue or worse, add the verbose (-v) switch to the command to debug the issue:

"C:\Program Files (x86)\PuTTY\pscp.exe" -scp -v -P 2134

That's that then. Now for the clean-up.

FYI, the -scp switch is unnecessary. I've only added it above to ensure a complete solution. Adding the full path to the pscp command is also unnecessary if you have the Putty directory added to your Windows global path. The following should work perfectly fine if you have done so.

pscp -P 2134

Finally, if you have the settings for the session saved (as say, foodyn) in PuTTY, then you can abbreviate things further to something like this:

pscp foodyn:/home/druss/Desktop/

For the really lazy, you can shorten it even more if you are happy to make the transfer to the default destination directory with:

pscp sessionname:

(note the trailing colon)

Easy Peasy Japanesey!

Hope this helps! Good luck :)