Backup via SSH

multiplex your ssh connection

This lets you make an ssh connection without needing to go through the lengthy key negotiation step each time. If you are running a script which makes many ssh connections to the same host (like perhaps for multiple rsync commands), this will make it much much faster.

On the client side, create ~/.ssh/config:

Host *
ControlMaster auto
ControlPath ~/.ssh/remote-mux-%r@%h:%p

Using SSH keys

This is not a backup issue per se, but ssh is used for most remote backups, and it is neccessary to run unattended. By using ssh keys, one process can ssh to another host without specifying a password.

user@srchost> ssh-keygen -t rsa
user@srchost> ssh-copy-id -i ~/.ssh/ backupuser@backuphost

The first line creates a ssh key pair. The public key is stored in ~/.ssh/ The second line copies this public key to the other host and adds it to the list of authorized keys.

With this set up, ‘user’ should be able to ssh on machine ‘srchost’ to machine ‘backuphost’ as user ‘backupuser’ without specifying a password. Test it out:

 user@srchost> ssh backupuser@backuphost

also see this:
which details how to restrict what programs the remote user can execute.


for lack of a better place to put this link:
good tutorial on fancy ways of using ssh