Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

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 at 2:04
2  
@Dominique This can only be done after SSH has been configured. It's not an alternative to what you did. –  Hauke Laging May 4 at 2:18

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.