Back Up Linux And Windows Systems With BackupPC - Page 3

4 The BackupPC Configuration Files

BackupPC's configuration files are in the /etc/backuppc directory. The most important ones are /etc/backuppc/ and /etc/backuppc/hosts. You should open them now to become familiar with all configuration options. Both files are heavily commented, so by reading them you should understand what they do. For example, in /etc/backuppc/ you can define how often and when BackupPC wakes up to back up the clients, when/how often it does full or incremental backups, how many log files it should keep, etc.

vi /etc/backuppc/

vi /etc/backuppc/hosts

Don't modify them now - most default values are ok to get started.


5 Add The Ubuntu System falko-desktop As A Backup Client

To add a client to BackupPC, we must add it to /etc/backuppc/hosts. That file has the following format:

host        dhcp    user      moreUsers
hostname1     0     user1     anotheruser,athirduser
hostname1     1     user2     stillanotheruser

The first column contains the hostname/NetBIOS name of the client (e.g. falko-desktop), the second column whether the client is configured through DHCP, the third column contains a user that is allowed to log into the BackupPC web interface to manage that backup client, and the fourth (optional) column contains additional users that can do the same.

Although falko-desktop is configured through DHCP, dhcp should only be set to 1 if the following tests fail:

nmblookup falko-desktop

If the test is successful, it should display falko-desktop's current IP address:

querying falko-desktop on falko-desktop<00>

Now that you know falko-desktop's current IP address, run the same test in the other direction:

nmblookup -A

If successful, the output should look like this:

Looking up status of
        FALKO-DESKTOP   <00> -         B <ACTIVE>
        FALKO-DESKTOP   <03> -         B <ACTIVE>
        FALKO-DESKTOP   <20> -         B <ACTIVE>
        ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE>
        MSHOME          <00> - <GROUP> B <ACTIVE>
        MSHOME          <1d> -         B <ACTIVE>
        MSHOME          <1e> - <GROUP> B <ACTIVE>

        MAC Address = 00-00-00-00-00-00

Both tests were successful, so we can set dhcp to 0, and we put falko-desktop   0       falko into /etc/backuppc/hosts and comment out the localhost line:

vi /etc/backuppc/hosts

falko-desktop   0       falko
#localhost   0       backuppc

If the tests had not been successful, we would have put falko-desktop   1       falko into /etc/backuppc/hosts instead, and in addition to that we would have had to change the variable $Conf{DHCPAddressRanges} in /etc/backuppc/

We have added the user falko to the hosts file. That's the system user whom BackupPC will send email reports regarding falko-desktop, so we should create that user on the BackupPC server now:

useradd -m falko
passwd falko

In addition to that we must create a password for falko for the BackupPC web interface:

htpasswd /etc/backuppc/htpasswd falko

(If you like you can now open a second browser and log in as falko on

Now we must edit /etc/backuppc/ The backup method for falko-desktop will be rsync, so we set $Conf{XferMethod} = 'rsync';.
falko-desktop has just one (big) partition (/), so we set $Conf{RsyncShareName} = '/';. If you have multiple partitions to backup, you'd specify something like $Conf{RsyncShareName} = ['/', '/var', '/data', '/boot']; instead.

rsync will be tunneled through SSH (port 22). SSH needs to know the hostname or IP address of the client. Unless you have a DNS server that resolves falko-desktop to its IP address, SSH will not be able to resolve the name falko-desktop. Therefore we replace $host with $hostIP in $Conf{RsyncClientCmd} and $Conf{RsyncClientRestoreCmd}.

vi /etc/backuppc/

$Conf{XferMethod} = 'rsync';

$Conf{RsyncClientPath} = '/usr/bin/rsync';
$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+';
$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+';
$Conf{RsyncShareName} = '/';
#$Conf{RsyncShareName} = ['/', '/var', '/data', '/boot'];

(You might wonder now how we can specify options for multiple clients because the options for notebook will be different from those for falko-desktop. It works like this: the options in /etc/backuppc/ are global values that are valid for all clients unless they have their onw configuration file in /etc/backuppc, named after their hostname. So for notebook we will create /etc/backuppc/, and it will contain only the values that are different from the ones in /etc/backuppc/ In fact, we could have created /etc/backuppc/ for falko-desktop instead of modifying /etc/backuppc/

Next restart BackupPC:

/etc/init.d/backuppc restart

Share this page:

6 Comment(s)

Add comment


From: at: 2009-08-01 19:48:45

Backup aborted (Unable to read 4 bytes)

This probably means that you have not authenticated to the host with the proper name/IP before.

On the backuppc do these commands...
(Remember to say YES to Continue connecting)

ssh -l root whoami

and with hostname only

ssh -l root server1 whoami

and also with the IP

ssh -l root whoami

From: jennifer at: 2011-08-08 09:49:26

If i am able to ssh but however i am still getting the error 4 byte.


what does that means?

From: LB at: 2010-01-17 01:36:40

How can I do this to sync computers on my network to an external VPS on the internet? I can't get it to work.

I think it is the way to specify the hosts that is the problem...

From: Anonymous at: 2012-04-25 18:55:26

During installation, when the character-based GUI comes up and and asks you to choose apache (probably the only choice), you have to hit the spacebar to select it.  This isn't obvious and if you just hit return to go on, it'll finish installing as if everything's OK, but the web interface won't work.

From: at: 2009-04-07 19:47:32

make sure to 

touch authorized_keys2 

if the file doesn't exist before doing 

cat ~/.ssh/ >> ~/.ssh/authorized_keys2

From: at: 2011-03-09 18:01:48

This problem tends to crop up ever so often and users tearing their hair out while troubleshooting it.

When executing this command on the backuppc server:

ssh -l root whoami

Also execute the command with the hostname of the client:

ssh -l root falko-desktop whoami

If the hostname resolves then you will receive a prompt to confirm a rsa key.