next up previous contents index
Next: Wget Backup Up: Copying to another System Previous: NFS Backup   Contents   Index

Scp Backup

You can setup an account on the backup machine to allow you to login with a ssh public key instead of a password. This method of authentication allows you to copy files and not worry about how to type the passwords in. To create the keys make sure you have a .ssh/ directory in your home directory, then type:

bash$ ssh-keygen
Generating public/private rsa1 key pair.
Enter file in which to save the key (/home/bob/.ssh/identity): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/bob/.ssh/identity.
Your public key has been saved in /home/bob/.ssh/identity.pub.
The key fingerprint is:
9c:32:e7:09:68:eb:49:21:45:30:49:f9:05:08:6f:7c bob@bob.org

This will create the ssh1 key. Next type:

bash$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/bob/.ssh/id_dsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/bob/.ssh/id_dsa.
Your public key has been saved in /home/bob/.ssh/id_dsa.pub.
The key fingerprint is:
55:cc:60:97:67:2f:52:0f:e7:da:76:fc:5f:b6:88:1c bob@bob.org

This will create the ssh2 key. Now take the files that end in .pub and copy them into files authorized_keys and authorized_keys2 like this:

bash$ cp identity.pub authorized_keys
bash$ cp id_dsa.pub authorized_keys2

When you copy these files into the .ssh/ directory of the account you want to log into, they should enable you to authenticate using the keys instead of a password. All you still need to do is create a shell script to copy the files using scp.

Here is an example scp command:

bash$ scp backupdata.tar.gz bob@backup.bob.org:backupdir/


next up previous contents index
Next: Wget Backup Up: Copying to another System Previous: NFS Backup   Contents   Index
Joseph Colton 2002-09-24