NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home / News / Linux / Other Tips, Tricks and Tutorials

Other Tips, Tricks and Tutorials


Automated Remote Back-ups with rdiff-backup

How to setup an unattended back-up process.

By Mihai Marinof, Linux Editor

23rd of January 2007, 11:24 GMT

Adjust text size:


rdiff-backup is an utility capable of maintaining a back-up mirror of a file or directory over the network, on another server. It stores incremental rdiff deltas with the back-up, which allows you to recreate any back-up point. The back-up is encrypted through the SSH protocol, thus no one will be able to read the data being transferred. Moreover, rdiff-backup is saving bandwidth by making incremental back-ups.

Prerequisites

As for all back-ups, you should be planning what you want to do, before actually doing it. Next, you should make sure that both computers are reachable from the Internet (or at least the computer you want to back-up) and whether both computers have SSH (client and daemon) installed and configured properly. As an example for this guide, I'll back-up a directory on my work computer, to a directory on my home computer.

Installation

- First of all, you'll need to install rdiff-backup on both computers. This is a very popular utility so it's most likely to find it in your distribution's repository so use your package manager to install it. Eg:

Fedora:
CODE
# yum install rdiff-backup

Debian/Ubuntu:
CODE
$ sudo apt-get install rdiff-backup

- Now for the tricky part. Because rdiff-backup is using SSH, which asks for a password upon logging in, it will require human interaction during the actual back-up process. And because we are trying to setup an automated process, this is not what we want. Fortunately, this problem can be easily skipped by using SSH public keys. So, we'll need to create a pair of keys on the home computer, one of which will be saved on the work computer. Basically, these keys will tell the work machine that the home machine is allowed to login through SSH.

Generate a DSA key pair on the home computer:
CODE
$ ssh-keygen -t dsa

Hit enter when you are asked for the target directory and for the passphrase.

Send the public key to the work computer:
(The work computer has to have used the ssh client, otherwise, the .ssh directory won't exist)
CODE
$ cd $HOME
$ scp .ssh/id_dsa.pub work-user@work.computer.IP:~/.ssh

Log in to work PC and add the key to the list of authorized keys:
CODE
$ ssh work-user@work.computer.IP
$ cd .ssh
$ cat id_dsa.pub >> authorized_keys2
$ rm -rf id_dsa.pub

- Test if everything is ok: Log out and log back in, this time, you shouldn't be asked for a password.

Actual back-up process

- What we want to do here is back-up the scripts/ directory on the work PC to the home PC. To do this, type the following command on the home machine:

CODE
$ rdiff-backup -v4 --print-statistics work-user@work.computer.IP:://home/work-user/scripts/ scripts/

Automating the process with crontab

- On the home machine, type the following command to open the crontab editor:

CODE
$ crontab -e

It will open vi. If you don't know how to use it, I’ll try to explain shortly. Once it started, press INSERT key to start writing into it. Now, add the following line:
CODE
30 4 * * * /usr/bin/rdiff-backup work-user@work.computer.IP:://home/work-user/scripts/ scripts/
Now press ESCAPE key, then SHIFT + ; and finally, wq

As of now, every night at 4:30, the scripts directory from the work PC will be saved to /home/home-user/scripts directory and will be updated if any scripts are added to the work directory.
Read by 5,051 user(s) | Add comment | Link to this article TWEET THIS


Article rating:
Good (3.3/5) 9 vote(s)    

Subscribe to news | Print article | Send to friend

© Copyright 2001-2009 Softpedia
Contact:

 

 

SEARCH THE NEWS ARCHIVE :




Today's News
| Yesterday's News | News Archive


MORE RELATED ARTICLES:


Mounting Remote Directories through SSH

Installing Lighttpd on Fedora and Ubuntu

GNU Screen Tutorial

Setting Up A Central Syslog Server

Creating a Local Update Repository for FC6

Wolfenstein: Enemy Territory Server Setup

How to Bind a Range of IPs

Screencast Guide: Capure Your Linux Desktop on Video!

How to Setup an Encrypted Filesystem

Grant Root Privileges to Regular Users

User opinions:

No user comments yet.
Be the first to express your opinion using the form below!

Share your opinion:

Your Name:
Your Email Address:
(will not be used for commercial purposes)
Solve this to prove you're not a bot: =
Your review/opinion:

 




Windows tabGames tabDrivers tabMac tabLinux tabScripts tabMobile tabHandheld tabGadgets tabNews tab

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM