Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
deb11:backuppc [2024/03/18 12:08] – [Configuration for Windows 10 running WSL1] Bernard Condraudeb11:backuppc [2025/12/21 15:18] (current) – [Maintenance] Bernard Condrau
Line 18: Line 18:
   * [[deb9:luks|LUKS - Disk Encryption]]   * [[deb9:luks|LUKS - Disk Encryption]]
   * [[deb9:encrypted|Encrypted partitions/folders with auto-mount]]   * [[deb9:encrypted|Encrypted partitions/folders with auto-mount]]
 +
 +==== Setup remote ping ====
 +  * Make sure necessary apps are installed, see [[deb11:setup#install_and_configure_packages|Install and configure packages]]
 +  * Log in to the DiskStation with SSH, sudo to root, and create the file //backuppc// in folder /etc/sudoers.d/. As there is no //visudo// on DSM you must be extra careful to copy the following lines exactly, otherwise you may render sudo unable to elevate to root:<code>cd /etc/sudoers.d
 +sudo vim
 +# Allow backuppc
 +backuppc ALL=(root:root) NOPASSWD: /var/services/homes/backuppc/bin/rsync</code>
  
 ==== Setup boot configuration ==== ==== Setup boot configuration ====
Line 25: Line 32:
  
 ==== Maintenance ==== ==== Maintenance ====
 +  * Update host\\ <color red>**After OS change (hardware, SSH, etc.) of a host you must manually SSH into the host from the server to accept the changed SSH key**</color>
   * Delete a backup. If you delete several backups, delete non-filled backups which were taken after a filled backup first.<code>/usr/local/BackupPC/bin/BackupPC_backupDelete -h host -n num </code>[[http://backuppc.sourceforge.net/BackupPC-4.0.0.html#Other-Command-Line-Utilities|Other Command Line Utilities]] and [[https://github.com/backuppc/backuppc/blob/master/bin/BackupPC_backupDelete|BackupPC_backupDelete]]   * Delete a backup. If you delete several backups, delete non-filled backups which were taken after a filled backup first.<code>/usr/local/BackupPC/bin/BackupPC_backupDelete -h host -n num </code>[[http://backuppc.sourceforge.net/BackupPC-4.0.0.html#Other-Command-Line-Utilities|Other Command Line Utilities]] and [[https://github.com/backuppc/backuppc/blob/master/bin/BackupPC_backupDelete|BackupPC_backupDelete]]
 ==== Links ==== ==== Links ====
Line 95: Line 103:
   * Modify ping command in host access configuration (note: $sshPath is not resolved for PingCmd):<code>$Conf{PingCmd} = '/bin/ssh -p <port> -o ConnectTimeout=2 $host echo "1 packets transmitted, 1 received, 0% packet loss, time 0ms"';</code>   * Modify ping command in host access configuration (note: $sshPath is not resolved for PingCmd):<code>$Conf{PingCmd} = '/bin/ssh -p <port> -o ConnectTimeout=2 $host echo "1 packets transmitted, 1 received, 0% packet loss, time 0ms"';</code>
  
-==== Configuration for Windows 10 running WSL1 ==== +==== Configuration for Windows 11 (22H2 and higher) running WSL2 or Windows 10/11 running WSL1 ==== 
-  - Windows 10: Install [[win10:wsl|Windows Subsystem for Linux]] on Windows 10 hosts, which installs a //Debian// command line layer on top of your Windows 10 installation.\\ <color red>**WSL1 installs a bridged network connection which receives an IP address in the same subnet as Windows**</color>.+  - Windows 10: Install [[win10:wsl|Windows Subsystem for Linux]] on Windows 10 hosts, which installs a //Debian// command line layer on top of your Windows 10 installation.\\ <color orange>WSL1 installs a bridged (mirrored) networking mode which receives an IP address in the same subnet as Windows.</color> 
 +  - Windows 11: Enable [[win10:wsl|Windows Subsystem for Linux]] on Windows 11 hosts as //Windows feature//, then install //Debian// from the Microsoft store.\\ <color orange>Set the WSL networking mode to //mirrored// by creating file ''C:/Users/<user>/.wslconfig'' with following content:</color><file>[wsl2] 
 +networkingMode=mirrored</file>
   - Install ssh and rsync:<code>sudo apt install ssh rsync</code>   - Install ssh and rsync:<code>sudo apt install ssh rsync</code>
   - Harden [[deb9:ssh#Settings|SSH]] and restart the service.   - Harden [[deb9:ssh#Settings|SSH]] and restart the service.
Line 104: Line 114:
 %sudo ALL=(ALL:ALL) ALL %sudo ALL=(ALL:ALL) ALL
 backuppc ALL=(root:root) NOPASSWD: /usr/bin/rsync</code> backuppc ALL=(root:root) NOPASSWD: /usr/bin/rsync</code>
 +  - If it's a new machine you are connecting make sure the public key of the host is added to the server and you have connected manually from server to host to add to the ''known_hosts'' file<code></code>
   - Test rsync access as root with the following command from user ''backuppc'' on the BackupPC Server:<code>ssh <host> -p <port> sudo rsync --version</code>   - Test rsync access as root with the following command from user ''backuppc'' on the BackupPC Server:<code>ssh <host> -p <port> sudo rsync --version</code>
   - For Windows: start the following program as a task after user login in ''Task Scheduler'':<code>C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe -c "sudo /etc/init.d/ssh start"</code>   - For Windows: start the following program as a task after user login in ''Task Scheduler'':<code>C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe -c "sudo /etc/init.d/ssh start"</code>
Line 109: Line 120:
   * [[https://man.openbsd.org/OpenBSD-current/man8/sshd.8#AUTHORIZED_KEYS_FILE_FORMAT|authorized_keys]]   * [[https://man.openbsd.org/OpenBSD-current/man8/sshd.8#AUTHORIZED_KEYS_FILE_FORMAT|authorized_keys]]
  
-==== Configuration for Windows 11 running WSL2 or Hosts without fixed IP address ==== +==== Configuration for Windows 11 (lower than 22H2) running WSL2 or Hosts without fixed IP address (for example laptops when outside of your LAN) ==== 
-  - Windows 11: Enable [[win10:wsl|Windows Subsystem for Linux]] on Windows 11 hosts as //Windows feature//, then install //Debian// from the Microsoft store.\\ <color red>**WSL2 installs a NAT'ed network connection and assignes a new IP address on every reboot**</color>.+  - Windows 11: Enable [[win10:wsl|Windows Subsystem for Linux]] on Windows 11 hosts as //Windows feature//, then install //Debian// from the Microsoft store.\\ <color orange>WSL2 lower than 22H2 installs a NAT'ed network connection and assignes a new IP address on every reboot, so we need to establish a tunnel originating from the Host. For Hosts outside of your LAN we use the same approach.</color>
   - Install ssh, autossh and rsync:<code>sudo apt install ssh autossh rsync</code>   - Install ssh, autossh and rsync:<code>sudo apt install ssh autossh rsync</code>
   - Harden [[deb9:ssh#Settings|SSH]] and restart the service.   - Harden [[deb9:ssh#Settings|SSH]] and restart the service.
Line 121: Line 132:
   - Use ''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 unresponsive<code>ClientAliveInterval 60   - Use ''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 unresponsive<code>ClientAliveInterval 60
 ClientAliveCountMax 10</code> ClientAliveCountMax 10</code>
 +  - If it's a new machine you are connecting make sure the public keys are exchanged on host and server and you have connected manually from each side to add both to the ''known_hosts'' file<code></code>
   - Test rsync access as root with the following command from user ''backuppc'' on the BackupPC Server:<code>ssh localhost -p <reverse_port> sudo rsync --version</code>   - Test rsync access as root with the following command from user ''backuppc'' on the BackupPC Server:<code>ssh localhost -p <reverse_port> sudo rsync --version</code>
   - For Windows: start the following programs as a task after user login in ''Task Scheduler'' (sleep 1 second is required to give ''autossh'' time to drop into background before the shell is terminated):<code>C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe -c "sudo /etc/init.d/ssh start"   - For Windows: start the following programs as a task after user login in ''Task Scheduler'' (sleep 1 second is required to give ''autossh'' time to drop into background before the shell is terminated):<code>C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe -c "sudo /etc/init.d/ssh start"
Line 129: Line 141:
 === Reverse Ports === === Reverse Ports ===
   * Hera: 60022   * Hera: 60022
-  * Vulcan: 60122+  * Vulcan: 60322 
 +  * Heracles: 60422
   * Cassandra: 60522   * Cassandra: 60522