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

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 want to set up an rsync command as a cron job, so I need to find a way to supply my server password automatically to rsync.

Currently I have a shell script that looks like this:

rsync *.rss --password-file ~/rsync.password

The rsync.password file just contains my password.

However, when I run the script, I get:

The --password-file option may only be used when accessing an rsync daemon.
rsync error: syntax or usage error (code 1) at main.c(1241) [sender=3.0.7]

Could anyone let me know how to fix this, so I can start to run the shell script as a cron job?

share|improve this question
up vote 4 down vote accepted

What you really want to do is look at setting up public keys between the servers so they 'trust' each other and passwords are not needed.

Have a read here:

share|improve this answer
That links do not solve the problem when executing under cron.daily, it runs without password in a Termina – Albert Català Jun 17 at 19:24

Some times there is need to rsync without ssh involved, especially if rsync is running as a server on one side. In this case I wrote instructions, how to give rsync password from command line.

This is very good for scripting: rsync-without-prompt-for-password

share|improve this answer

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.