Use your FTP/SSH account as a backup service (Part 2)

Yesterday we created the archive of your site in


by using some simple Linux commands. Now we want to automatically copy the archive to another server…

We want to use the SSH (secure shell) command scp to copy the file automatically with a cron job over to a server you have a login to:

1.) Create your public key by using “ssh-keygen” on your linux box. It is most likely, that you want to create a RSA key, which is just the type of encryption: ssh-keygen -t rsa – you can go with the defaults.

2.) After that you have a public key in your hidden SSH directory in your home: “cd ~/.ssh/” and you should be in that directory.

3.) Copy that public key over to the destination server:


4.) Login to the destination server and check, if you have a SSH directory there as well with: “ls -la” – there should be a “.ssh” directory. If not, create one.
Now add the public key to the right file in that directory:

cat >>.ssh/authorized_keys

5.) Exit and check, if you can login to your destination server without beeing promted for a password!

If that is all done, you can now enhance your cron script from yesterday:

cd /wwwroot
tar -cvzf myarchive.tgz mysite.xy/
scp myarchive.tgz

And voila: every day your site is backuped and moved over to another Linux account.

We offer that service here as well, with slight motifications, let me know, if you need help!