01.23
These days large firms (for example like our Dutch telecom company called KPN) are offering a plethora of backups solution, usually nicely priced. However, these very often involve using proprietary software, which most of the time is only available for the Windows platform.
However, these is an easy solution for Linux, if you own a machine offsite with a decent Internet connection, preferably colocation. In this tutorial I’ll be using public key cryptography with ssh to enable automatic logins.
First you need to login into your backup server, and create a (remote) user account:
root@backup.host.com# useradd remoteuser
After that’s done, you’ll need to
localuser@localhost$ ssh-keygen
localuser@localhost$ ssh-copy-id -i .ssh/id_rsa.pub remoteuser@backup.host.com
localuser@localhost$ ssh remoteuser@backup.host.com mkdir backup
With the first command you need to leave the key password empty. With the second command you should fill in the correct user password, however with the third command, SSH shouldn’t ask you for the user password, and just login automatically, because we just put the (passwordless) ssh keys into place.
Next up, install grsync on the local machine (localhost) and create a new session called (for example) “backup”.
Source: /home/localuser
Destination: remoteuser@backup.host.com:/home/remoteuser/backup
Then, if you don’t want to backup all your dotfiles (i.e. program related settings), go to the “Advanced options” tab:
Additional options: –exclude=.*
Now you should be ready to test the backup setup, just click Execute. The first should will probably take some time. After that it should be quite fast. Now to make it even easier, you could drag the grsync icon from the Applications menu to the GNOME Panel, and change it’s Properties:
Execute: grsync -e backup
Now, when using the new icon, grsync won’t be bothering you any more with the settings, It’ll immediately execute the “backup” session.
If you no longer want to login from other hosts, you can optionally disable the normal password, which means the previously generated ssh key will be mandatory for login purposes
root@backup.hosts.com# passwd –lock remoteuser
Regular password based login will now be disabled.
