I want to copy files from a local machine to a remote machine.

I have the command all set up and it looks like this:

rsync -a project [email protected]:~

However, when running this command, I'm prompted with a message to enter the remote server's password.

When setting this up as a cronjob it fails because the password is not entered.

What is way around this? How can I create my cron job to run the command and enter in the password?

1 Answer 1


You can use public key authentication: on the server, add a line with the command run by rsync (for security) and your public key to ~root/.ssh/authorized_keys. See the sshd(8) man page for information on the authorized_keys file format.

  • I added my local machine's SSH key and it still prompts for password. Oct 7, 2014 at 21:31
  • Oops, did the opposite. Oct 7, 2014 at 21:31

You must log in to answer this question.

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