Super User is a question and answer site for computer enthusiasts and power users. 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 run rsync from a script and that's working fine but of course this will only work if the machine has the necessary SSH keys installed. Sometimes the script is run on other machines and the process hangs because it is waiting for a password.

I'd like to tell rsync that whenever it requires interactive authentication it should just fail and exit instead of waiting. However I was unable to find such an option in the man page.

So I'm not looking for a way to tell rsync the right password but a way to prevent any interaction if that means rsync termination.

Alternatively is there a way to know (from another process) if rsync is waiting for a password/abort the password prompt?

share|improve this question
ssh is doing the authentication, so check if there's an ssh option to do what you need. – dr-jan Apr 29 '13 at 12:02
up vote 0 down vote accepted

Thanks to dr-jan I was able to figure it out myself:

rsync -e "ssh -o 'BatchMode yes'" [the usual rsync parameters]
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .