Misc note : dump/restore over ssh
Just a note for my own reference on dump/restore over ssh. It is fun to dump/restore for remote backup.
GENERATING SSH KEY (SOURCE HOST)
Generate ssh key in src box. (example is without passphrase).
srcbox:~/.ssh$ ssh-keygen -b 2048 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/chfl4gs/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/chfl4gs/.ssh/id_rsa.
Your public key has been saved in /home/chfl4gs/.ssh/id_rsa.pub.
The key fingerprint is:
42:76:31:fb:dc:7a:37:9d:b7:f0:64:c1:d8:1e:6d:4a chfl4gs@srcbox
SSH CONFIG FILE SETUP (SOURCE HOST)
Create a config file in .ssh directory.
Host dstbox Port 22 User chflags Compression yes Protocol 2 RSAAuthentication yes StrictHostKeyChecking no ForwardAgent yes IdentityFile /home/chfl4gs/.ssh/id_rsa
DESTINATION HOST SETUP
cat /home/chfl4gs/.ssh/id_rsa.pub content and paste it to dst box. In this example, I use chflags as a user. Thus create and put into /home/chflags/.ssh/authorized_keys2
TESTING
ssh dstbox
and you should be able to ssh without any password prompt.
ACTION (SOURCE HOST)
dump -0 -f - / | ssh chflags@dstbox "cd /home/chflags/backup; cat - | restore -r -f -"
dump -0 -f - /usr | ssh chflags@dstbox “cd /home/chflags/backup/usr; cat - | restore -r -f -”
Voila!



