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 would like to run rsync without the need to enter a password. I understand I can do this using ssh keys and once the right key has been copied over to the remote server rsync logs in fine without user interaction.

However when the key has been changed, has been removed, or, say in case of some automation, a server has been added to a list of servers to be rsync'ed, I would like rsync to not be prompted for a password.

Meaning, rsync should only attempt to use password-less login with ssh and if that doesn't work move on without having to deal with a password prompt and a possible lengthy timeout.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You can configure the SSH client to not attempt password authentication:

rsync -e 'ssh -o PasswordAuthentication=no' ...

There is also a BatchMode option which disables password authentication and decreases the timeout:

rsync -e 'ssh -o BatchMode=yes' ...
share|improve this answer
    
I did try both options before asking the question and couldn't get it to work. But I tried again and it does do the job, so I must have made a mistake before. My first test was part of a larger script, now I tried on the command line. Thanks. –  aseq Feb 26 '13 at 18:53
add comment

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.