2 Setting up the remote back up machine

The first step is to set up the remote back up machine. For security reasons, it is better to initiate the back up from the back up machine instead of the Moodle server. It goes without saying that the back up server itself should be secure.

Add a user account just for backing up the Moodle server. This way, it is less likely to accidentally modify or delete the back up files.

adduser moo  
  

Next, change user as moo using the command su moo. First, set up the SSH key for this account:

ssh-keygen  
  

Just accept all the default settings, and do not specify a passphrase. Otherwise, it’ll be impossible to automate the back up script.

The next step involves adding the public key of moo to the user account moodle on the Moodle server. You have to append the file ~moo/.ssh/id_rsa.pub to the end of the file ~moodle/.ssh/authorized_keys. You can do this with a single command:

cat ~moo/.ssh/id_rsa.pub | ssh moodle@server "cat >> ~/.ssh/authorized_keys"  
  

After this step, the user moo can authenticate to the moodle server as moodle without any interactive passwords.