0
votes

I'm looking for assistance with using rsync from a ubuntu server and my local windows machine. I am running Cygwin64 on my local machine. I would like to execute rsync on the ubuntu server to move files to my local machine, but I am having trouble with how to specify the directory and specifying a port. I have forwarded my port 52000 for both TCP and UDP traffic through my router to my computer running Cygwin64 and made an exception for windows firewall settings on this machine.

Here are the parts of my code I am using and need help with

rsync --update -- ignore-existing --progress -vure ssh

I have seen may ways to specify the port I want to use. I want to use the options within the command line instead of changing my ssh config file (not sure if I would need to change it on the ubuntu server or my windows machine running Cygwin64). I have seen -p port, 'ssh -port' and others. I also am not sure how to write it if I am running the rsync command from the ubuntu server or my windows machine. I suspect that it is only needed if I am running rsync command from the ubuntu server so that rsync will use port 52000 to connect to my local windows machine. I suspect that if I tried to run rsync on my windows Cygwin64 machine and specify a port, it would be like my Cygwin64 machine telling the ubuntu server which port to open to ssh incoming traffic and I suspect that the owner of the server has only opened the typical ssh port to traffic (22 right?) so it would just say 'no' and not work (I have tried this and it gives me an error-but maybe I wrote the command line wrong?)

This is the second part I need help with

[USER@]HOST:SRC DEST

Currently I can successfully use this format and the above rsync commandline options from within cygwin64 to to pull files from the ubuntu server to my local cygwin64 drive.

/[user@host]:/home/[user]/downloads/1/ /cygdrive/e/1

If I try to change the ssh port how would this need to change? If I were to run rsync from the ubuntu server how would I change it as I don't know what my windows64 machine running Cygwin64 user name or host (I currently get IPS from my cable company in the USA).

Since there are a number of issues with this, please feel free to help with all or just one.

Thanks. -S

1

1 Answers

1
votes

You can do that with

rsync -e 'ssh -p 8022' -av --delete /path/to/source user@remote:/path/to/target

I've used port 8022 in my example, and added the -av --delete options to rsync, which is a common setup, if you want to sync two folders several times. (Or set your options, as posted in your question.)

If you can connect to SSH server of the machine with the IP address xxx.xxx.xxx.xxx without entering a port number, you can use the following:

rsync -e ssh -av --delete /path/to/source [email protected]:/path/to/target