Page 2: Transfer Setup, Restoration, Improvements, Conclusion
Transfer Settings:
There are a few ways to transfer data to the BackupPC server and which you use for each client depends on what the clients has installed. If the client is a Windows based PC, using smb (Samba) is most likely the easiest choice. For Unix-like operating systems, you can use rsync or rsyncd depending if you are running a rsync server on the client or not. Each configuration will be touched upon. We will now be using the command line to perform these tasks.
BackupPC has a global configuration file and then can have configurations for each host it backs up. The directory /etc/backuppc/ contains all the configuration files. If you want a specific host based configuration you need to have a file in that directory for the host. We will add an "asewebdns.pl" file into that directory for the new host to backup.
For each example the client PC's username to log in as will be "<username>" without the quotes. Password will be "<password>".
Rsync:
The rsync method is the best choice for Linux or Unix type PCs. As long as the client PC runs SSH, you can select this option. There is some setup involved such as exchanging SSH keys. This is a once time process. Using SSH keys is very secure as long as your server remains secure. If your server keys are compromised, so are the boxes.
The config file for this setup looks like this:
The first line says to use the rsync transfer type. The second line is a hint to tell where the rsync executable lies on the client PC. The third holds the command to backup the PC and the fourth for restoring. What you will need to edit is the <username> fields and possibly the last line which holds the path to backup. This path must be readable by the username. Since the boxes I'm backing up are primarily one user, I only back that account up. You should use root for backing up the entire PC and make the share name "/" for everything. The backup command basically says to use SSH with some switches to log in as <username> at the host's IP address with the command passed for rsync. Fairly straight forward.
Now we need to setup the client PC to handle this request without asking to log-on. You need to first be logged in as the backuppc user. At a prompt, type:
sudo su backuppc
This will bring you to (probably) a sh shell. Type 'bash' to get to a bash prompt. You'll want to use the directory for backuppc's home. Type "cd ~" at the prompt. Now you want to generate a rsa key from ssh. Type:
ssh-keygen -t rsa
Which will look like this:
Accept the defaults and press enter for everything. Now we want to copy the id_rsa file you just made onto the client PC. We also need to exchange public keys which we can do in one step. Type:
scp /var/lib/backuppc/.ssh/id_rsa.pub <username>@<clientpc>:/home/<username>/sshkey.server.rsa (Ex: scp /var/lib/backuppc/.ssh/id_rsa aron@asewebdns:/home/aron/sshkey.server.rsa)
The scp program runs off of ssh and it will ask you to verify the authenticity of the client. Accept and enter your password for the client machine. When the file has been copied, you need to ssh into the client machine. Type:
ssh <username>@<clientpc> (Ex: ssh aron@asewebdns)
Now the client PC will just ask for your password. You should now be at a bash prompt. Type:
cat ~/sshkey.server.rsa >> ~/.ssh/authorized_keys2
That command took the server's key and added it to the client PC's authorized key list to enable passwordless logins for that specific username. You should now delete the key. Type:
rm ~/sshkey.server.rsa
Type "exit" to get off the client PC. Type "exit" again to log out of the backuppc user on the server. Type "exit" again to completely log off. You are done with the command line portion. Now all you need to do is check that the backup will be successful. Go to the web interface and start a backup. It should now work normally. Congratulations. You setup BackupPC for rsync!
Rsyncd:
This type of transfer assumes that there is a rsync daemon running on the client PC. This type of setup might be a rsync server that you want to backup. This case is trivially easy. The file for the config will look like:
Really, no extra setup is required since the client computer already has an rsync server running. You'll want to modify the share name and the user and password lines. Notice how the share name config option is the same as the previous type of transfer.
Smb:
This transfer type uses Samba which is perfect for Windows clients. You can use the default administrative share to grab the files off of a Windows PC as long as you have an administrator log-in and password. I'll use backup/backup for that purpose now. The file looks like:
You may not know what that "C$" sharename means. A share with a dollar sign after it means hidden in the Windows world. This special share is always enabled and basically shares out all the partitions by name. There is will special shares for each partition. If you have a "D" partition, expect a "D$" share. Make sure that file and printer sharing is enabled in the Windows firewall.
That was really all the setup that's needed for the Windows boxes.
Restoration:
Restoring files directly on the client PC is as simple as starting a backup is. On the host selection screen, switch to the client PC you want to restore files for. You have the option of directly restoring files or downloading the backups. I suggest always to download the backups. A direct restore will overwrite whatever is contained on the client PC.
Select the files you want to restore and hit the restore selected files button. This takes you to a screen that will show you the files and how to restore them. From this screen you can select the option you want. You'll probably want to make a zip of them to download. That was easy.
Improvements:
I would like to see BackupPC be able to be controlled fully by the browser. You should be able to setup new host configurations and such all on the web. Another problem is that the current version of BackupPC I was running (3.0.0) doesn't show a transfer status. You just need to wait till a transfer is done. This is a problem. I would like to know how long the backup will take.
Conclusion:
BackupPC is a very handy free and open source tool to use in your home or business. It is robust enough to handle a variety of tasks and simple enough to be setup.You can try BackupPC if you have a Linux distribution by heading over to the Sourceforge page. It beats paying for software that does the same stuff and works on pretty much every platform. Once again, please »post on the forums with any questions or comments you have.
There are a few ways to transfer data to the BackupPC server and which you use for each client depends on what the clients has installed. If the client is a Windows based PC, using smb (Samba) is most likely the easiest choice. For Unix-like operating systems, you can use rsync or rsyncd depending if you are running a rsync server on the client or not. Each configuration will be touched upon. We will now be using the command line to perform these tasks.
BackupPC has a global configuration file and then can have configurations for each host it backs up. The directory /etc/backuppc/ contains all the configuration files. If you want a specific host based configuration you need to have a file in that directory for the host. We will add an "asewebdns.pl" file into that directory for the new host to backup.
For each example the client PC's username to log in as will be "<username>" without the quotes. Password will be "<password>".
Rsync:
The rsync method is the best choice for Linux or Unix type PCs. As long as the client PC runs SSH, you can select this option. There is some setup involved such as exchanging SSH keys. This is a once time process. Using SSH keys is very secure as long as your server remains secure. If your server keys are compromised, so are the boxes.
The config file for this setup looks like this:
Code
$Conf{XferMethod} = 'rsync';
$Conf{RsyncClientPath} = '/usr/bin/rsync';
$Conf{RsyncClientCmd} = '$sshPath -q -x -l <username> $hostIP $rsyncPath $argList+';
$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l <username> $hostIP $rsyncPath $argList+';
$Conf{RsyncShareName} = '/home/<username>/';
$Conf{RsyncClientPath} = '/usr/bin/rsync';
$Conf{RsyncClientCmd} = '$sshPath -q -x -l <username> $hostIP $rsyncPath $argList+';
$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l <username> $hostIP $rsyncPath $argList+';
$Conf{RsyncShareName} = '/home/<username>/';
The first line says to use the rsync transfer type. The second line is a hint to tell where the rsync executable lies on the client PC. The third holds the command to backup the PC and the fourth for restoring. What you will need to edit is the <username> fields and possibly the last line which holds the path to backup. This path must be readable by the username. Since the boxes I'm backing up are primarily one user, I only back that account up. You should use root for backing up the entire PC and make the share name "/" for everything. The backup command basically says to use SSH with some switches to log in as <username> at the host's IP address with the command passed for rsync. Fairly straight forward.
Now we need to setup the client PC to handle this request without asking to log-on. You need to first be logged in as the backuppc user. At a prompt, type:
sudo su backuppc
This will bring you to (probably) a sh shell. Type 'bash' to get to a bash prompt. You'll want to use the directory for backuppc's home. Type "cd ~" at the prompt. Now you want to generate a rsa key from ssh. Type:
ssh-keygen -t rsa
Which will look like this:
Code
backuppc@asetest:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/backuppc/.ssh/id_rsa):
Created directory '/var/lib/backuppc/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/backuppc/.ssh/id_rsa.
Your public key has been saved in /var/lib/backuppc/.ssh/id_rsa.pub.
The key fingerprint is:
4b:xx:b4:xx:55:f3:xx:2c:xx:32:49:a5:xx:ea:9b:11 backuppc@asetest
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/backuppc/.ssh/id_rsa):
Created directory '/var/lib/backuppc/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/backuppc/.ssh/id_rsa.
Your public key has been saved in /var/lib/backuppc/.ssh/id_rsa.pub.
The key fingerprint is:
4b:xx:b4:xx:55:f3:xx:2c:xx:32:49:a5:xx:ea:9b:11 backuppc@asetest
Accept the defaults and press enter for everything. Now we want to copy the id_rsa file you just made onto the client PC. We also need to exchange public keys which we can do in one step. Type:
scp /var/lib/backuppc/.ssh/id_rsa.pub <username>@<clientpc>:/home/<username>/sshkey.server.rsa (Ex: scp /var/lib/backuppc/.ssh/id_rsa aron@asewebdns:/home/aron/sshkey.server.rsa)
The scp program runs off of ssh and it will ask you to verify the authenticity of the client. Accept and enter your password for the client machine. When the file has been copied, you need to ssh into the client machine. Type:
ssh <username>@<clientpc> (Ex: ssh aron@asewebdns)
Now the client PC will just ask for your password. You should now be at a bash prompt. Type:
cat ~/sshkey.server.rsa >> ~/.ssh/authorized_keys2
That command took the server's key and added it to the client PC's authorized key list to enable passwordless logins for that specific username. You should now delete the key. Type:
rm ~/sshkey.server.rsa
Type "exit" to get off the client PC. Type "exit" again to log out of the backuppc user on the server. Type "exit" again to completely log off. You are done with the command line portion. Now all you need to do is check that the backup will be successful. Go to the web interface and start a backup. It should now work normally. Congratulations. You setup BackupPC for rsync!
Rsyncd:
This type of transfer assumes that there is a rsync daemon running on the client PC. This type of setup might be a rsync server that you want to backup. This case is trivially easy. The file for the config will look like:
Code
$Conf{XferMethod} = 'rsyncd';
$Conf{RsyncShareName} = 'backup';
$Conf{RsyncdUserName} = '<username>';
$Conf{RsyncdPasswd} = '<password>';
$Conf{RsyncdAuthRequired} = 1;
$Conf{RsyncShareName} = 'backup';
$Conf{RsyncdUserName} = '<username>';
$Conf{RsyncdPasswd} = '<password>';
$Conf{RsyncdAuthRequired} = 1;
Really, no extra setup is required since the client computer already has an rsync server running. You'll want to modify the share name and the user and password lines. Notice how the share name config option is the same as the previous type of transfer.
Smb:
This transfer type uses Samba which is perfect for Windows clients. You can use the default administrative share to grab the files off of a Windows PC as long as you have an administrator log-in and password. I'll use backup/backup for that purpose now. The file looks like:
Code
$Conf{SmbShareName} = 'C$';
$Conf{SmbShareUserName} = 'backup';
$Conf{SmbSharePasswd} = 'backup';
$Conf{XferMethod} = 'smb';
$Conf{SmbShareUserName} = 'backup';
$Conf{SmbSharePasswd} = 'backup';
$Conf{XferMethod} = 'smb';
You may not know what that "C$" sharename means. A share with a dollar sign after it means hidden in the Windows world. This special share is always enabled and basically shares out all the partitions by name. There is will special shares for each partition. If you have a "D" partition, expect a "D$" share. Make sure that file and printer sharing is enabled in the Windows firewall.
That was really all the setup that's needed for the Windows boxes.
Restoration:
Restoring files directly on the client PC is as simple as starting a backup is. On the host selection screen, switch to the client PC you want to restore files for. You have the option of directly restoring files or downloading the backups. I suggest always to download the backups. A direct restore will overwrite whatever is contained on the client PC.
Select the files you want to restore and hit the restore selected files button. This takes you to a screen that will show you the files and how to restore them. From this screen you can select the option you want. You'll probably want to make a zip of them to download. That was easy.
Improvements:
I would like to see BackupPC be able to be controlled fully by the browser. You should be able to setup new host configurations and such all on the web. Another problem is that the current version of BackupPC I was running (3.0.0) doesn't show a transfer status. You just need to wait till a transfer is done. This is a problem. I would like to know how long the backup will take.
Conclusion:
BackupPC is a very handy free and open source tool to use in your home or business. It is robust enough to handle a variety of tasks and simple enough to be setup.You can try BackupPC if you have a Linux distribution by heading over to the Sourceforge page. It beats paying for software that does the same stuff and works on pretty much every platform. Once again, please »post on the forums with any questions or comments you have.