Configure server for ssh and tar backups
The best way to backup a Linux client is via ssh and tar. The server will SSH into the client, execute a privileged tar command, and stream the content back to the server over the connection.
To enable this approach the server has to be configured to allow this. Create a BackupPC user that will connect.
Create BackupPC Server SSH keys
On the BackupPC server the user needs a set of SSH keys to log into client machines. Change to user BackupPC;
sudo su - backuppc
ssh-keygen -t rsa
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Check if the user can now log in and accept the SSH key. If this is not done the client will not be able to log in because of the prompt;
ssh -l backuppc localhost whoami
Configure BackupPC XFer
Set TarClientPath to use the local sudo command and the newly created BackupPC tar script command;
TarClientPath = /usr/bin/sudo /usr/bin/backup_tar
The tar backup command makes use of the SSH command in the first part to establish the connection with the server. The -q setting performs the connection quietly, the -l specifies the user to use.
The tar command will again include the sudo command as specified in TarClientPath. The -c option will create a new archive, while -v specifies verbose, --totals return the bytes processed for use in BackupPC for reporting.
TarClientCmd = $sshPath -q -x -n -l backuppc $host env LC_ALL=C $tarPath -c -v -f - -C $shareName+ --totals
The restore command is very much the same, except it does not include the -n for SSH and replaces -c with -x to specify extract.
TarClientRestoreCmd = $sshPath -q -x -l backuppc $host env LC_ALL=C $tarPath -x -p --numeric-owner --same-owner -v -f - -C $shareName+
The parameter for the list all files are as follows;
TarFullArgs = $fileList+
And for incremental backups;
TarIncrArgs = --newer=$incrDate+ $fileList+