How to set up backuppc in ubuntu client
Posted in technology1. Generate SSH keys
First, become the root user and generate SSH keys. If you already have SSH keys (id_rsa and id_rsa.pub) 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.ssh-keygen -t rsa
cd ~/.ssh
ls
The above is to make sure you have id_rsa & id_rsa.publs
cp id_rsa.pub clientname_id_rsa.pub
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
chmod 600 id_rsa
2. Exchange SSH keys with Server
Email 'clientname_id_rsa.pub' 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 (BackupPC_id_rsa.pub), 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/BackupPC_id_rsa.pub /root/.ssh/
cat BackupPC_id_rsa.pub >> authorized_keys2
cd /root/.ssh/
touch authorized_keys2
mv /location/of/the/file/BackupPC_id_rsa.pub /root/.ssh/
cat BackupPC_id_rsa.pub >> 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="xxx.xxx.xxx.xxx" 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 'clientname.pl' where clientname is the name of your computer.gedit clientname.pl
Copy and paste the following.$Conf{XferMethod} = 'rsync';
$Conf{BackupFilesExclude} = ['/tmp', '/media', '/mnt', '/floppy', '/stuff/unwanted'];
$Conf{ClientNameAlias} = 'xxx.xxx.xxx.xxx';
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).$Conf{BackupFilesExclude} = ['/tmp', '/media', '/mnt', '/floppy', '/stuff/unwanted'];
$Conf{ClientNameAlias} = 'xxx.xxx.xxx.xxx';
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.- clientname_id_rsa.pub
- clientname.pl
0 comments: