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 root@123.456.789.0:~

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?


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.

| improve this answer | |
  • I added my local machine's SSH key and it still prompts for password. – Noah Matisoff Oct 7 '14 at 21:31
  • Oops, did the opposite. – Noah Matisoff Oct 7 '14 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.