how to copy a file over ssh from a remote machine?(linux to windows)

I presume that you are invoking Putty on a Windows machine and using it to connect to some UNIX machine.

If that the case you cannot do what you want because putty is like a thin client giving you a terminal access.

I would suggest you to install cygwin using which can help you with both the functionality of Putty and also allow you to use SCP.

Within cygwin you can do something like

scp -r  <user>@<remoteHost>:<pathtofile>/<fileName> <localfilename>

You could do like this, not sure if this will work using putty, but it's worth a try:

 ssh <user>@<host> cat /<path_to_file>/<filename> > <local_filename>

I just tried putty and the above will not work, but if you are running an ssh server on your windows machine I guess you would be able to do this:

  1. Connect to the remote unix machine using: ssh <user>@<host>
  2. Transfer the file from the unix machine using: ssh <user>@<host> cat </path/file ">" filename

You could also use scp if the program is installed:

scp <user>@<host>:/path/file <filename>

Look at this link: Network File copy using SSH


I suggest (in order of preference):

  • SFTP through Filezilla Client. Available for Windows, Linux, OSX, in 34 & 64 bits. It works the best, deals with codepages, strange characters, autoretries connections, parallelizes transfers if possible, and works with some other protocols (FTP, SFTP, FTPS... etc). Just connect to:

    sftp://YourSSHServer

  • Total Commander with SFTP PlugIn. Fails with some characters, but for sailing through directories is very useful. And... I LOVE the avesome Total Commander interface.

Tags:

Ssh

Putty