If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below. ** If you are logged in, most ads will not be displayed. **

rsync asking for password - not suitable for crontab invocation

In the past I have executed the script with this rsync invocation from cron with no problem. But I recently upgraded my Linux OS (to 2.6.16.60-0.76.8-smp) and now rsync is asking for a password. I am logged in as root. How should I code in order for this rsync to proceed without asking for a password? (Note: the remote host root password is the same as the local host root password).

If you want to access a remote system without using a password, the remote system needs to "trust" your computer. To make it trust you, you need to copy your SSH public key to the remote host. If you don't have a key, you can generate one with ssh-keygen. You can follow the steps in this brief tutorial. Save your public key on the remote system. As long as the remote SSH client can use the public key from the remote system, it will not ask for a password.

If you can install rsyncd (the daemon) on one end, you can configure the rsyncd to do what you want. You can create users with restricted rights to directories. And have rsync access that user from the command line.

The trust relationship was broken when you upgraded the remote host. Had you backed up the SSH keys and put them back into place on the new system, then you would be good to go (apart from a different system RSA fingerprint conflict -but that's another problem).

On your remote host/upgraded PC, you need to generate keys, e.g.:

Code:

ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

then copy them to your original pc. There's a script included with the OpenSSH package to assist with this, e.g.:

Code:

ssh-copy-id -i ~/.ssh/id_dsa root@<ORIGINAL_PC_IPADDR>

now the contents of the upgraded PC's pubkey should be in ~/.ssh/authorized_keys2 file on the original PC.

Test that keys are working by going to the remote/upgraded Linux PC and doing: