rsync: create ssh-key for cron backups


1. Create a Key on the “Origin Server”

# ssh-keygen

root@Asterisk:~# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh’.

Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Press enter to create the SSH Key without a password (not sure of the no password implications, in our case our servers are behind a firewall so I’m not worried about security issues)

2. Copy the Key to “Destination” Server

# ssh-copy-id -i ~/.ssh/ admin@destinationip

root@Asterisk:~# ssh-copy-id -i ~/.ssh/ admin@
The authenticity of host ‘ (’ can’t be established.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys
admin@’s password:

Number of key(s) added: 1

Now try logging into the machine, with: “ssh ‘admin@′”
and check to make sure that only the key(s) you wanted were added.

3. Test if the Key transfer has been succesful

To check this, try to SSH to the other server and if access is granted without requesting password the Key is correctly installed

#ssh user@destinationip

Importante Consideration…


4. Try doing some rsync tests.

rsync -az /var/spool/asterisk/monitor/test.wav root@192.168.X.X:/volume1/NetBackup/Servers/MIA/Asterisk

Leave a Reply

Your email address will not be published. Required fields are marked *