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 (
bar.zip) from a Windows host to a Linux server (with the destination path of
"C:\Program Files (x86)\PuTTY\pscp.exe" -scp -P 2134 -pw mypassword bar.zip firstname.lastname@example.org:/home/druss/Desktop/
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).
-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 bar.zip email@example.com:/home/druss/Desktop/
That's that then. Now for the clean-up.
-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 bar.zip firstname.lastname@example.org:/home/druss/Desktop/
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 bar.zip 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 bar.zip sessionname:
(note the trailing colon)
Easy Peasy Japanesey!
Hope this helps! Good luck :)