Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need some help getting my rync command syntax working. I need to clone the /home/user/public_html folder on a remote server to the server I am logged into via SSH, copying the folder into the same exact path on this local machine.

I have root on the local machine I'm in session on and a user account shell on the remote machine. I'm not clear on where to put the SSH login info and how to define the folder paths.

share|improve this question
up vote 1 down vote accepted


rsync -avz user@remoteMachine:/home/user/public_html /home/user/public_html 
share|improve this answer
I managed to figure it out via trial and error but this is the correct command. One note for future google searches - I had already set up the domain to be moved and kept getting empty files from rsync. It was resolving the local host as the domain, I had to use the remote IP to finally get the transfer to work. (Same user and pass on both machines for the domain created part of the problem). It was just "sending" the local files back to itself. That one had me confused for an hour or so... – user71106 Feb 17 '11 at 18:34

rsync -urltv -e ssh user@remote:public_html /home/user/public_html

share|improve this answer
rsync on any Linux distro released in the last five years defaults to ssh. -e ssh is only needed if you're trying to set ssh flags like -i or change the encryption. – kashani Feb 17 '11 at 7:43
@kashani, the entire world doesn't use Linux, and the questioner didn't specify. My way is portable. – Paul Tomblin Feb 17 '11 at 13:25
heh, alright if you can find an OS shipped in the last five years where you need to specify the -e ssh I'll upvote you. Definitely not needed on BSD, Solaris, or OSX. – kashani Feb 17 '11 at 16:28
The reason this command did not work is that the public_html folder is not in the user's shell home. The user had access to the full / path so the full path was needed to make the transfer work. For some reason they had set up the user's actual home in a folder in / rather than the system /home folder which also created some confusion on my part of a while. – user71106 Feb 17 '11 at 18:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.