Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 have a bash script that executes rsync transfers to a remote location, and every time I execute the script I get asked for a password.

Is there a way to avoid this?

This is the command I use: rsync -av /source usr@ip:/destination

share|improve this question
up vote 6 down vote accepted

Use rsync over SSH and use an SSH key without a passphrase.

man rsync:

-e, --rsh=COMMAND         specify the remote shell to use

rsync -e ssh ...

share|improve this answer
I used ssh-keygen and ssh-copy-id but this looks easier. – Dominique May 4 '14 at 2:04
@Dominique This can only be done after SSH has been configured. It's not an alternative to what you did. – Hauke Laging May 4 '14 at 2:18

Your Answer


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.