0

I want to copy a few folders from Windows PC to Linux machine. I am using Putty and connected to my Linux PC. In PuTTY, i executed following command where i am trying to copy files from Windows folder path to the present folder in Linux:

scp -r user_name@IPAddr_Windows_PC:C:\Test\Folder .

I am getting a `connection refused error. Please let me know if anything is wrong with the command that i am using. I need the correct command, since i have to develop a script.

vijayanand1231
  • 447
  • 1
  • 7
  • 20
  • You could use Filezilla or similar with an SFTP connection to transfer files from the windows box to Linux. – Rob Apr 20 '15 at 10:28
  • 1
    Use [WinSCP](http://winscp.net/). If you use PuTTY, you are on your server already and can't access your local files unless you also have an SSH daemon on your Windows machine. For simple use cases, `scp` is typically executed on the source machine, not on the destination. – Michael Jaros Apr 20 '15 at 10:29

1 Answers1

0

The scp command executing on the linux machine assumes there is an sshd daemon server running on the target machine which will open up port 22 and listen for incoming ssh requests. A file transfer subsystem (sftp in linux, don't know what the Windows equivalent is) will then be launched by the sshd daemon to respond to the file transfer request.

The "connection refused" is caused by no process listening to port 22 on the Windows machine.

You should probably consider initiating the transfer in the reverse direction (as in the scp suggestion above). Another option would be to use "rsync". On Linux rsync is a common tool, and for Windows you can find rsync compatible programs written in Python.

The rsync command would look something like this:

rsync C:/mydocuments/myfiles/ my.linux.machine::myfiles

This example assumes an rsync daemon is available on the target machine.

Hankster
  • 422
  • 3
  • 9