BackupPC is a great backup program for an Ubuntu server. However, it doesn’t work “out of the box” due to Ubuntu’s lack of a root account. This is what I had to do to make it work.
Modify /etc/backuppc/localhost.pl
- Run “sudo nano /etc/backuppc/localhost.pl”
- Add sudo to the TAR Client and ClientRestore commands
-
Change $Conf{TarClientCmd} to read
$Conf{TarClientCmd} = '/usr/bin/env LC_ALL=C sudo $tarPath -c -v -f - -C $shareName'
. ' --totals'; -
Add $Conf{TarClientRestoreCmd} to read
$Conf{TarClientRestoreCmd} = 'sudo $tarPath -x -p --numeric-owner --same-owner'
. ' -v -f - -C $shareName';
The following changes are optional.
-
Change $Conf{BackupFilesExclude} (for my config - these seem to all be temp files that you don’t really need to backup) to read
$Conf{BackupFilesExclude} = ['/proc', '/dev', '/tmp', '/mnt', '/media', '/sys', '/lost+found', '/usr/src', '/var/lib', '/var/tmp', '/var/cache', '/var/spool', '/var/run', '/var/lock', '/var/games', '/home/*/.Trash', '/home/*/.mozilla/*/*/Cache', '/home/*/.mozilla/*/*/Cache.Trash']; -
Change $Conf{XferMethod} to read
$Conf{XferMethod} = 'tar'; -
Change $Conf{TarFullArgs} to read
$Conf{TarFullArgs} = '$fileList'; -
Change $Conf{TarIncrArgs} to read
$Conf{TarIncrArgs}= '--newer=$incrDate $fileList';
End optional changes
Add backuppc to the sudoers list
- Run “sudo visudo”
-
At the bottom of the file add
-
# Allow backuppc to run tar without a password
backuppc ALL=NOPASSWD: /bin/tar
Delete all of the text from /etc/backuppc/localhost.pl. This will prevent the “per-PC” defaults from overriding the changes above.
By adding sudo to the TAR commands in /etc/backuppc/config.pl and adding backuppc to the sudoers list, you’re able to perform both backups and restores directly from the web-based interface.
Und wenn der Restore nicht läuft... (wird wohl nur in Zusammenhang mit ssh benötigt).
Hier mein Logauszug:
Contents of file /var/lib/backuppc/pc/localhost/RestoreLOG.3.z, modified 2008-06-06 09:35:29 (Extracting only Errors)
Running: /usr/bin/ssh -q -x -l root localhost env LC_ALL=C \
/bin/tar -x -p --numeric-owner --same-owner -v -f - -C /home
Running: /usr/share/backuppc/bin/BackupPC_tarCreate -h \
localhost -n 18 -s /home -t -r /juerg -p /juerg/ /juerg/areca-5.1-b
Xfer PIDs are now 1883,1884
Tar exited with error 65280 () status
restore failed: BackupPC_tarCreate failed
Zuerst schauen wir, ob folgendes als User backuppc ohne Passwort klappt:
ssh -l root localhost
Wenn nicht schauen wir nach, wie man ssh ohne Passwort
einrichtet. z.B. hier http://www.sequenz.ch/archive/2004/08/16/ssh-zugang-ohne-passwort.html
Damit es am Ende dann wirklich funktionierte, musste ich einmal als user
backuppc von Hand folgendes aufrufen:
/usr/bin/ssh -q -x -l root localhost
und zwar weil der rsh-key (glaub ich) noch bestätigt werden musste.
Eine weitere Hürde kann das Programm denyhosts darstellen. Dieses hat meinen lokalen root-Zugriff gesperrt. Somit konnte ich keine Restores erstellen. Ich musste in der /etc/hosts/deny den Eintrag von Hand löschen, damit ich den Root Zugriff für den user backuppc einrichten konnte.
Good luck




