Alternatively, you can instead choose the 'sync' mode which synchronises the backup you have with the files & folders that are currently on your laptop. This is similar to the 'backup' mode but with one important difference - with sync mode, if you delete a file or folder on your laptop, the same file or folder will be deleted from the backup. After all, you're literally synchronising the backup with your laptop, so that they both end up with exactly the same data.
Here is a step by step guide to what you have to do:
dpkg -l rsync
andy@ubuntu2:~$ dpkg -l rsync Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-================================= ii rsync 3.1.0-2ubunt amd64 fast, versatile, remote (and loca
dpkg-query: no packages found matching rsync
sudo apt-get install -y rsync
ls -ald ~/.ssh
mkdir ~/.ssh
ssh-keygen -b 1024 -t rsa
(ssh-keygen will be on your path on most Linux systems but if you get a 'command not found' warning, on some systems you may need to prefix the ssh-keygen command with the full path to the ssh-keygen utility - this might be /usr/bin/ssh-keygen or /usr/local/bin/ssh-keygen, for example).
You will be prompted for the filename in which to save the key and you can just hit return to accept the default, which is to put it in the .ssh subdirectory of your home directory as the file id_rsa. Next you will be prompted for a passphrase - hit return here and again at the next prompt as you don't want one. Finally ssh-keygen will save both your private and public keys as the files id_rsa and id_rsa.pub respectively as in this example:
andy@ubuntu2:~ $ ssh-keygen -b 1024 -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/andy/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/andy/.ssh/id_rsa. Your public key has been saved in /home/andy/.ssh/id_rsa.pub. The key fingerprint is: 76:36:b7:e3:5c:8e:8d:02:7a:5e:39:4a:02:a6:eb:70
ssh username@lapback1.ma.ic.ac.uk mkdir .ssh
where 'username' is your college username (if your username on your laptop matches your college username, you can omit the 'username@' bit in the above command); you will be prompted for your backup server password. Now copy your public ssh key to the backup server:
scp ~/.ssh/id_rsa.pub username@lapback1.ma.ic.ac.uk:.ssh/authorized_keys
giving your backup service password when prompted.
ssh username@lapback1.ma.ic.ac.uk
You should find that you are logged into the server without being prompted for a password. (If you are not used to using ssh private/public keypairs for remote logins and are scared by this, don't worry! It is not as insecure as it seems as the combination of your hidden private key and the matching public key means that only you can log into the backup server, and then only from your laptop. So it is actually more secure than using a password and avoids the bother of being prompted for a password every time you do a backup).
(On Linux systems your home directory will usually be /home/your_laptop_username but you may have changed this to something else and on some other UNIXes, it may be something like /export/home/your_laptop_username, /usr/users/your_laptop_username, etc. If in doubt, typing 'echo $HOME' on any Linux or UNIX system will tell you where your home directory is).
sudo mv sync2lapback /usr/local/bin sudo mv auto-backup2lapback /usr/local/bin
sudo chmod 755 /usr/local/bin/sync2lapbackup sudo chmod 755 /usr/local/bin/auto-backup2lapbackup
sync2lapback
sync2lapback sync
- #
- # start the auto-backup 5 minutes after booting
- @reboot sleep 300; /usr/local/bin/auto-backup2lapbackup
- # retry at 10, 15 and 20 minutes after booting if earlier attempts fail
- @reboot sleep 600; /usr/local/bin/auto-backup2lapbackup
- @reboot sleep 900; /usr/local/bin/auto-backup2lapbackup
- @reboot sleep 1200; /usr/local/bin/auto-backup2lapbackup
Research Computing Manager, Department of Mathematics
last updated: 23.10.2016