From Electron Cloud
Line 14: | Line 14: | ||
#!/bin/sh | #!/bin/sh | ||
cat ~/.ssh/id_rsa.pub | ssh -p <the-port> root@${1} "cat - >> .ssh/authorized_keys" | cat ~/.ssh/id_rsa.pub | ssh -p <the-port> root@${1} "cat - >> .ssh/authorized_keys" | ||
+ | |||
+ | To send a backup tarball from a machine to a server (minus dev mnt proc sys tmp, which can be recreated as empty directories later): | ||
+ | |||
+ | tar zcvf - bin boot chroot etc home lib* opt root run sbin srv usr var | ssh root@i7.local "cat > /home/rutledge/backups/radeon/no-x11-plus-gentoo-chroot.tgz" | ||
To pull a backup tarball from a server and install it locally (e.g. after booting from a rescue CD): | To pull a backup tarball from a server and install it locally (e.g. after booting from a rescue CD): | ||
ssh root@server "cat /path/to/backup.tgz" | tar zxvf - | ssh root@server "cat /path/to/backup.tgz" | tar zxvf - |
Revision as of 14:39, 19 February 2014
So for quick copying, to generate an SSH key pair on the client machine:
ssh-keygen -t rsa
and to send your client machine's key to any server on which you wish to be able to log in without a password (e.g. ~/bin/send-key):
#!/bin/sh cat ~/.ssh/id_rsa.pub | ssh ${1} "cat - >> .ssh/authorized_keys"
or if there is a non-standard port number:
#!/bin/sh cat ~/.ssh/id_rsa.pub | ssh -p <the-port> root@${1} "cat - >> .ssh/authorized_keys"
To send a backup tarball from a machine to a server (minus dev mnt proc sys tmp, which can be recreated as empty directories later):
tar zcvf - bin boot chroot etc home lib* opt root run sbin srv usr var | ssh root@i7.local "cat > /home/rutledge/backups/radeon/no-x11-plus-gentoo-chroot.tgz"
To pull a backup tarball from a server and install it locally (e.g. after booting from a rescue CD):
ssh root@server "cat /path/to/backup.tgz" | tar zxvf -