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 want to tryout Rsync for the first time but have run into difficulty.

I want to transfer files from a remote server to my local server.

I login to my local server and type:

sudo rsync -avz ssh ubuntu@xx.xxx.xx.xx /var/www/html/mywebsite.co.uk /var/www/html/

Which means I want to to copy the folder 'mywebsite.co.uk' from the remote server into the /var/www/html folder on my local server.

Both severs are configured to use the same ssh key.

I get the following errors:

sending incremental file list
rsync: link_stat "/var/www/html/ssh" failed: No such file or directory (2)
rsync: link_stat "/var/www/html/ubuntu@xx.xxx.xxx.xx" failed: No such file or directory (2)

sent 55 bytes  received 13 bytes  136.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]

Can anybody help me understand these errors?

Thanks in advance!

share|improve this question
1  
Try -e "ssh ubuntu@a.b.c.d" instead of just ssh ubuntu@a.b.c.d. –  MadHatter Jan 30 at 10:14
    
Thats worked! But now I get the error: Permission denied (publickey). –  Bob Flemming Jan 30 at 10:24
    
Then I submit that you don't, in fact, have working keys. –  MadHatter Jan 30 at 16:23

3 Answers 3

Your syntax is incorrect. Should be

sudo rsync -avz -e ssh ubuntu@xx.xxx.xx.xx:/var/www/html/mywebsite.co.uk /var/www/html/

Missing the -e operator for ssh. And you need colon after the ip address.

share|improve this answer

When specifying a remote location with SSH (which require -e ssh, otherwise it uses rsync own protocol and requires rsync server/daemon to be started on the other end), you have to write it following this pattern :

[user@]short_name[.domain]:[path]

If you ommit user@ it willl assume the remote user is the same that the one used on the local machine If you ommit .domain it will use your domain search settings (like any other name resolution) If you omit path it will use the remote user's home directory (Note: it's the same as writing user@server:~ )

So here, you just have to replace the space by a colon : like Grumpy wrote it in his answer.

share|improve this answer
    
Thats worked! But now I get the error: Permission denied (publickey). –  Bob Flemming Jan 30 at 10:44

try below syntax

rsync -e ssh -avz ubuntu@xx.xxx.xx.xx:/var/www/html/mywebsite.co.uk root@50.23.148.226:/var/www/html/

Also you can include ssh key & port if required

rsync -e "ssh -p PORT_NO -i path_to_file" -avz ubuntu@xx.xxx.xx.xx:/var/www/html/mywebsite.co.uk root@xx.xx.xxx.xx:/var/www/html/
share|improve this answer
    
You might want to remove your IP from your answer... –  Grumpy Feb 1 at 13:26

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.