Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 1 down vote accepted

run:

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

 
discard

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.