BackupPC on Ubuntu

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/config.pl

  • Run “sudo vim /etc/backuppc/config.pl”
  • Add sudo to the TAR Client and ClientRestore commands
    • Change $Conf{TarClientCmd} to read
      $Conf{TarClientCmd} = 'sudo $tarPath -c -v -f - -C $shareName'
      . ' --totals';
    • Change $Conf{TarClientRestoreCmd} to read
      $Conf{TarClientRestoreCmd} = 'sudo $tarPath -x -p --numeric-owner --same-owner'
      . ' -v -f - -C $shareName';
  • 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';

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.

Leave a Reply

You must be logged in to post a comment.