Saturday, November 14, 2009

0

How to set up backuppc in mac client

1. Generate SSH keys

We will call the name of the user 'linus.' So every time you see 'linus', replace it with your own username. First, in your home directory, as the linus user,
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
ls

The above is to make sure you have id_rsa & id_rsa.pub
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 linus;
chown linus:linus 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 /home/linus/.ssh directory, you can skip the third command.

cd /home/linus/.ssh/
touch authorized_keys2
mv /location/of/the/file/BackupPC_id_rsa.pub /home/linus/.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.
If you use vi for the first time, click here for more information.

gedit /home/linus/.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 /home/linus/.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} = [.Trash', '/Trash', '/automount', '/Network', '/private/var/automount', '/private/var/run', '/private/var/vm', '/private/var/tmp', '/private/tmp', 'Caches', 'CachedMessages', '/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).
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'];
If you wish to add more options (otherwise the default settings will be used), please refer to the BackupPC documentation website.


4. Submit Files to Administrator

Now let us send the following files and information to the administrator (by email or whatever) if you have not dones so already.
  1. clientname_id_rsa.pub
  2. clientname.pl
  3. Your username (in our case it is linus).
At this point, the administrator should get back to you with your own username and password (which they might ask you to come up with) and the good news that your back up service is up and running.



5. Turn On SSH Server

In Mac OS X, SSH is installed by default, but the server part of it is not turned on. To turn it on, click on the beloved apple --> System Preference --> Sharing. You should see a screen like the one below.
Mac Sharing
Click on 'Remote Login' under services and close the window.

0 comments: