Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I set up a rsync between two hosts without providing any password?

share|improve this question

migrated from Feb 22 '13 at 13:58

This question came from our site for professional and enthusiast programmers.

That should be very helpful: – Tom Feb 22 '13 at 12:40
Maverick143 has provided an answer, but this question doesn't really belong on StackOverflow as it has little to do with programming. would have been more relevant. – Martin Feb 22 '13 at 12:50

2 Answers 2

up vote 11 down vote accepted

Below is the article from The Geek Stuff

1. Test rsync over ssh (with password):

Do a rsync to make sure it asks for the password for your account on the remote server, and successfully copies the files to the remote server.

The following example will synchronize the local folder /home/test to the remote folder /backup/test (on server).

This should ask you for the password of your account on the remote server.

rsync -avz -e ssh /home/test/ user@

2. ssh-keygen generates keys.

Now setup ssh so that it doesn’t ask for password when you perform ssh. Use ssh-keygen on local server to generate public and private keys.

$ ssh-keygen

Enter passphrase (empty for no passphrase):

Enter same passphrase again: Note: When it asks you to enter the passphrase just press enter key, and do not give any password here.

3. ssh-copy-id copies public key to remote host

Use ssh-copy-id, to copy the public key to the remote host.

ssh-copy-id -i ~/.ssh/

Note: The above will ask the password for your account on the remote host, and copy the public key automatically to the appropriate location. If ssh-copy-id doesn’t work for you, use the method we discussed earlier to setup ssh password less login.

4. Perform rsync over ssh without password

Now, you should be able to ssh to remote host without entering the password.


Perform the rsync again, it should not ask you to enter any password this time.

rsync -avz -e ssh /home/test/ user@
share|improve this answer
This well help better. – meMangesh Feb 22 '13 at 12:44
Clear copy and paste from you should reference the original author. – Lawrence Cherone May 9 '14 at 20:12

Genarate the public key in ServerA

$ ssh-keygen
$ Enter passphrase (empty for no passphrase):
$ Enter same passphrase again:

The public key will be generated and stored in


Copy public key to remote host

ssh-copy-id -i ~/.ssh/


  • Open, copy the content
  • Login to ServerB using the same user in the rsync command
  • In ServerB, append the contents to ~/.ssh/authorized_keys. Create the file if not exist. Make sure the file mode is 700.

I followed this article and it helps me

share|improve this answer

Your Answer


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