Search code examples
cmdrsync

rsyncing using cygwin's rsync from the Windows Command Prompt


I am pushing a local file to a folder in a remote location using cygwin's rsync from the Windows Command Prompt.

The below command

D:\My Folder>C:/cygwin/bin/rsync.exe  -avh data.csv [email protected]::~"overhere/"

returns the error, "failed to connect to someserver.com : connection timed out"

When I try the following command to place the file in the remote location root folder,

D:\My Folder>C:/cygwin/bin/rsync.exe  -avh data.csv [email protected]~

it says "sending incremental file list" but I am not able to find the file in the root folder in the remote location.

What am I doing wrong?


Solution

  • The timeout most likely occurs because there is no rsync daemon running on the server known as someserver.com. Using :: after the remote host name will cause rsync to try to connect to the rsync daemon running on that machine. If you use : instead, rsync will attempt a shell access to copy your data.

    Your second call to rsync.exe succeeds because rsync.exe -avh data.csv [email protected]~ creates a copy of data.csv in your current working directory named [email protected]~.

    If you use shell access, you can directly provide the path after the :, if using the rsync daemon, you have to provide the module name as configured in /etc/rsyncd.conf on the server after the ::. So in your case it is either [email protected]:~/overhere/ for shell access or [email protected]::MODULE for the daemon. But as I suspect that you have no rsync daemon running on the remote machine, you'd have to install and configure it first for the second version to work. The first version will do through normal SSH access.

    So as a first attempt you can try: D:\My Folder>C:/cygwin/bin/rsync.exe -avh data.csv [email protected]:overhere/ This will create a folder named overhere in the ec2-user's home directory on someserver.com if it doesn't already exist and copy the local data.csv into that directory.