How to download Ubuntu Server backups automatically?

Solution 1:

Is your dekstop an Ubuntu (or other Linux) machine?

I ask because if it were, and this were me, I'd write a simple script on the desktop that mounts (using sshfs) the server into the local filesystem (although this is probably not required)) and then uses rsync to create a backup of your data. Then I'd just set a cron-job on the desktop to run the backup. I'm doing it this way around (rather than having the server push a backup) because only the desktop knows when it's turned on. It seems silly to add another layer of logic when you could just have the desktop do all the heavy lifting.

For an efficient back-up system, you do also have to be conscious of what data you need to back up. There's usually little value in cloning the entire filesystem once a day because the most likely restore procedure will be a re-imaging that restores most of the system.

Most occasions, it only makes sense to have a copy of your unique data (your websites and their databases or whatever you're running on the server), the /etc/ dir (to speed up reconfiguring the reimaged server) and a list of packages that were installed so you can do a bulk-apt-get-install.

Of course, I'm not you and I imagine my servers are configured differently to yours so what data you need is ultimately up to you.

To get you started, a simple rsync command could be:

rsync -avze ssh [email protected]:/data/ /local/backup/path/

For this to work transparently without ineraction, you'll want to set up ssh key auth which will bypass a password prompt but does raise a security issue (your dekstop user can log in without a password!).

If that's an issue, you could run a script on the server to create a backup .tar.gz and then create a new user who only has permission to get this one file. Then alter your desktop script to log in with this new backup user and grab the tar.

Or you could have the desktop script promt you for the ssh password. Not fully automated but fairly easy.