This is an old revision of the document!
This guide is written when installing BackupPC V4.4.0 which is included in the repository of Debian 11 Bullseye.
/etc/BackupPC
or /etc/backuppc
, and /etc/apache2
if you install it over a previous BackupPC installationBackupPC
and manually remove them and their contentsapt install backuppc
htpasswd /etc/backuppc/htpasswd <user>
config.pl
in /etc/backuppc/
or /etc/BackupPC/
and correct all file paths. The Debian packet manager install uses different folders to keep the installation files.sudo systemctl disable backuppc.service
systemctl start backuppc.service service backuppc start
/usr/local/BackupPC/bin/BackupPC_backupDelete -h host -n num
All hosts are setup with rsync through ssh. For Windows 10 hosts I use the Windows Subsystem for Linux which allows to setup a Debian layer to access the host. To backup the localhost we need a small tweak which is explained below.
$Conf{PoolV3Enabled} = 0; $Conf{BlackoutPeriods} = [{ hourBegin => 10, hourEnd => 3, weekDays => [0, 1, 2, 3, 4, 5, 6], }]; $Conf{XferMethod} = 'rsync';
$Conf{CgiNavBarLinks} = [ { link => "?action=view&type=docs\" target=\"blank", lname => "Documentation", } { link => "https://github.com/backuppc/backuppc/wiki\" target=\"blank", lname => "Wiki", } { link => "https://backuppc.github.io/backuppc\" target=\"blank", lname => "Homepage", } ];
perl -e 'print(gethostbyname("myhost") ? "ok\n" : "not found\n");'
nmblookup myhost
If this fails you will see output like:
name_query failed to find name myhost
If it is successful you will see output like:
local.domain.subnet.ip myhost<00>
nmblookup -B local.domain.subnet.255 myhost
If necessary, experiment with the nmblookup command which will return the IP address of the host given its name. Then update $Conf{NmbLookupFindHostCmd} with any necessary options to nmblookup.
ssh <host>
$Conf{RsyncClientPath} = '/usr/bin/rsync'; $Conf{RsyncSshArgs} = ['-e', '/usr/bin/sudo -p'];
$Conf{BackupFilesOnly} = ['/etc', '/root', '/home', '/usr', '/var', '/boot', '/sys'];
sudo apt install ssh rsync
sudo visudo %sudo ALL=(ALL:ALL) ALL backuppc ALL=(root:root) NOPASSWD: /usr/bin/rsync
$Conf{RsyncClientPath} = 'sudo /usr/bin/rsync'; $Conf{RsyncSshArgs} = ['-e', '$sshPath'];
$Conf{RsyncShareName} = ['/']; $Conf{BackupFilesExclude} = ['/proc', '*.vdi'];
$Conf{RsyncClientPath} = 'sudo /usr/bin/rsync'; $Conf{RsyncSshArgs} = ['-e', '$sshPath -p <port>']; $Conf{PingCmd} = '/usr/bin/sudo /usr/sbin/hping3 $host -p <port> -c 1 -S'; $Conf{PingMaxMsec} = 300; $Conf{ClientNameAlias} = 'subdomain.domain.tld';
$Conf{RsyncShareName} = ['/']; $Conf{BackupFilesExclude} = ['/proc', '*.vdi'];
apt update apt install hping3
$Conf{PingCmd} = '/bin/ssh -p <port> -o ConnectTimeout=2 $host echo "1 packets transmitted, 1 received, 0% packet loss, time 0ms"';
sudo apt install ssh rsync
sudo adduser --shell /bin/rbash --disabled-password backuppc
restrict,from="local.domain.subnet.ip" ssh-rsa <BASE64-PUBKEY-REPRESENTATION> backuppc
It should further be owned by root and being read- but not writable by the backuppc user, to prevent removal of SSH restrictions. In older SSH versions you must enter the following instead of restrict:
no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,from="local.domain.subnet.ip" ssh-rsa <BASE64-PUBKEY-REPRESENTATION> backuppc
sudo visudo %sudo ALL=(ALL:ALL) ALL backuppc ALL=(root:root) NOPASSWD: /usr/bin/rsync
known_hosts
file
backuppc
on the BackupPC Server:ssh <host> -p <port> sudo rsync --version
Task Scheduler
:C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe -c "sudo /etc/init.d/ssh start"
sudo apt install ssh autossh rsync
sudo adduser --shell /bin/rbash --disabled-password backuppc
sudo visudo %sudo ALL=(ALL:ALL) ALL backuppc ALL=(root:root) NOPASSWD: /usr/bin/rsync
autossh -M 0 -f -N -R <reverse_port>:localhost:<ssh_port> host.domain.tld -p <wan_port>
Note: -M -f are autossh options, all others are ssh options; <reverse_port> is the port you will use to access the host from the server through the reverse ssh tunnel, <ssh_port> is the ssh port on the host, and <wan_port> is the ssh port on the server accessible from the wan.
autossh
instead of ssh
to reestablish the ssh connection if it drops - add the following options in the server's sshd_config
to have ssh drop the connection if unresponsiveClientAliveInterval 60 ClientAliveCountMax 10
known_hosts
file
backuppc
on the BackupPC Server:ssh localhost -p <reverse_port> sudo rsync --version
Task Scheduler
(sleep 1 second is required to give autossh
time to drop into background before the shell is terminated):C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe -c "sudo /etc/init.d/ssh start" C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe -c "autossh -M 0 -f -N -R <reverse_port>:localhost:<ssh_port> host.domain.tld -p <wan_port> && sleep 1"
bash.exe
. In addition you need to allow <user> to execute /etc/init.d/ssh
as root without password.
localhost
on port <reverse_port>.Rsync over ssh: "ERROR: module is read only" suddenly appeared
cd /home/<user>/temp wget https://download.samba.org/pub/rsync/rsync-3.1.3.tar.gz tar xzvf rsync-3.1.3.tar.gz cd rsync-3.1.3 export CFLAGS=--static ./configure make
restrict,from="local.domain.subnet.ip" ssh-rsa <BASE64-PUBKEY-REPRESENTATION> backuppc
It should further be owned by root and being read- but not writable by the backuppc user, to prevent removal of SSH restrictions.
cd /etc/sudoers.d sudo vim # Allow backuppc backuppc ALL=(root:root) NOPASSWD: /var/services/homes/backuppc/bin/rsync
$Conf{RsyncShareName} = ['/', '/home'];
$Conf{RsyncShareName} = ['/', '/mnt/c', '/mnt/d']; $Conf{BackupFilesExclude} = [ '/proc', '*.vdi', 'Windows10Upgrade', 'System Volume Information', '$RECYCLE.BIN', '*.mkv', ];
documents
then add the line as shown below in the sample config file:$Conf{RsyncShareName} = ['/', '/volume1']; $Conf{BackupFilesExclude} = [ '/proc', '@eaDir', 'media', '*.mkv', '*.vdi', # exclude any shared folders here '@documents@', ];
$Conf{RsyncClientPath} = 'sudo /var/services/homes/backuppc/bin/rsync';
$ /bin/ping <host> -c 1
$ sudo /usr/sbin/hping3 <host> -p <port> -c 1 -S
$ ssh -p <port> -o ConnectTimeout=2 <host> echo "1 packets transmitted, 1 received, 0% packet loss, time 0ms"
$ /bin/echo
I'm not using any of the methods described in below links. I have collected those during my search for the best way to integrate Windows hosts into BackupPC. If you need to backup a host which does not run Windows 10, or does not provide the Microsoft Windows Subsystem for Linux, then those links might be helpful.
pc/HOST
directories (e.g. “*.mp3”)find /data/BackupPC/pc/HOST/5 -name “*.mp3” -exec rm -f {} ;
should be sufficient without updating the attrib files. At this point not much disk space will be freed.documents
the file system will contain the folder documents
which serves the decrypted files real-time, DO NOT touch these. Next to the shared folder documents
exists another folder @documents@
which contains the encrypted physical copy of the file, so remove directory and entire content of @documents@
.pool/cpool
, you cannot easily determine the name of the pool file without computing the MD5 digest - see BackupPC::Lib::File2MD5() and BackupPC::Lib::MD52Path().