Saturday, November 14, 2009


How to set up backuppc in ubuntu client

Posted in

1. Generate SSH keys

First, become the root user and generate SSH keys. If you already have SSH keys (id_rsa and in /root/.ssh/, then you can skip the first 2 commands.
sudo -i
ssh-keygen -t rsa
It will ask for where to store the file and passphrase. Do not enter anything and just keep pressing enter. Now let's make a copy of the public key for the server.
cd ~/.ssh
The above is to make sure you have id_rsa &
clientname is the name of your computer (which appears in your terminal; eg linus@linusbox:~$ - in this case linusbox is your computer name). I am assuming that you have a unique computer name on your network. The private key file (id_rsa) is something that you must guard with your life! (ok i'm exaggerating) Let's make sure that it's non-readable by anyone else but the root;
chown root:root id_rsa
chmod 600 id_rsa

2. Exchange SSH keys with Server

Email '' to the administrator so that they can put it in the server's .ssh directory.

To allow the server access to your computer, obtain the public SSH key of the server from the administrator.

Once you have the server public key (, you must add it to the authorized key list. If you already have a file named 'authorized_keys2' in your /root/.ssh directory, you can skip the third command.
sudo -i
cd /root/.ssh/
touch authorized_keys2
mv /location/of/the/file/ /root/.ssh/
cat >> authorized_keys2
/location/of/the/file/ is obviously where you downloaded and placed the file. Now for additional security, we want to limit the allowed host to the backup server. Note that I use the text editor gedit, but you can use vi, nano, kate, or anything else.
gedit /root/.ssh/authorized_keys2
Add the address of the server at the beginning of the file to make the file look like this: (bolded part)
from="" ssh-rsa [base64 key, eg: ABwBCEAIIALyoqa8....]
Make sure again the permission is set correctly.
chmod -R go-rwx /root/.ssh

3. Create Config File

Now in your home directory as the regular user, create your configuration file named '' where clientname is the name of your computer.
Copy and paste the following.
$Conf{XferMethod} = 'rsync';
$Conf{BackupFilesExclude} = ['/tmp', '/media', '/mnt', '/floppy', '/stuff/unwanted'];
$Conf{ClientNameAlias} = '';
This file assumes that you want to back up everything in your harddrive except for the directories specified in the config file. To add more directories to be excluded, simple add the paths to the directories in the second line following the syntax shown above (ie wrap the path with '' and have a comma and a space in between).
If you wish to back up only the specified files, then replace the second line with the following and likewise add desired directory paths to that line following the syntax.
$Conf{BackupFilesOnly} = ['/myFiles', '/important', '/home/linus/stuff'];

4. Submit Files to Administrator

Now let us send the following files to the administrator (by email or whatever) if you have not dones so already.