Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:rsyncbackup [2023/02/16 17:03]
darron [Configuration]
projects:rsyncbackup [2023/10/14 14:23] (current)
darron [Configuration]
Line 17: Line 17:
  
 === Install === === Install ===
 +
 +Whether you install on a backup server or target host, fetch scripts from repository.
  
 <code> <code>
Line 23: Line 25:
  
 == Server == == Server ==
 +
 +The server install will create a user called rsync, its home directory, a cron
 +entry and place the scripts within a bin directory. The purge process is added
 +to sudoers for the rsync user and the rsync binary is installed in the home directory setuid root.
 +
 +The backup folder by default is /opt/fs/rsync and this is created, along with a log directory /var/log/rsync
 +
 +The backup directory can be changed prior to install by editing the SYNCDIR variable in the file bin/config
  
 <code> <code>
 sudo make install-server sudo make install-server
 +</code>
 +
 +__ssh__
 +
 +ssh should be setup manually and the install process created a .ssh directory
 +ready for this.
 +
 +Changing to user rsync is best achieved like this:
 +
 +<code>
 +sudo -s
 +/bin/su - rsync
 </code> </code>
  
 == Client == == Client ==
 +
 +__Full backup__
 +
 +For targets hosts, perform the client install. This creates the user rsync and copies the scripts into the home directory and creates a setuid root rsync binary and nothing more.
  
 <code> <code>
Line 34: Line 60:
 </code> </code>
  
 +__User backup__
 +
 +For user only backup on a target, the requirements are ssh access and rsync
 +being available. If these two cases are met then when configuring the host,
 +the login parameters and path to rsync must be set in the target config (see below).
 +
 +__ssh__
 +
 +The server ssh  public key must be added to the authorized_keys file
 +to access the client.
 ===Configuration=== ===Configuration===
  
-An RSA ssh key with an empty passphrase must be generated and the public key added to target hosts in authorized_keys on each target for user rsync when using the client installed above, or as a login user otherwise.+An RSA ssh key with an empty passphrase must be generated and the public key added to each target's authorized_keys for user rsync when using the client installed above, or added to for the login user otherwise.
  
 ==Variables== ==Variables==
Line 43: Line 79:
  
 ^ Variable ^ Usage ^ Default ^ ^ Variable ^ Usage ^ Default ^
-|ETCDIR   | rsync host config | /home/rsync/etc |+|ETCDIR   | rsync target host config | /home/rsync/etc |
 |SYNCDIR  | rsync backup directory | /opt/fs/rsync | |SYNCDIR  | rsync backup directory | /opt/fs/rsync |
 |RSYNC    | local and remote rsync command | /home/rsync/bin/rsync| |RSYNC    | local and remote rsync command | /home/rsync/bin/rsync|
 |PURGE    | directory purge command or empty | sudo /home/rsync/bin/purge| |PURGE    | directory purge command or empty | sudo /home/rsync/bin/purge|
  
-==Hosts==+==Target hosts==
  
 Each target host can have up to three server configuration files in ETCDIR. Each target host can have up to three server configuration files in ETCDIR.
Line 76: Line 112:
 <code> <code>
 #! /bin/bash #! /bin/bash
-SSH="ssh -2 -p 2222 -l loginname"+SSH="ssh -2 -p 2222 -l loginname -o StrictHostKeyChecking=no"
 RSYNC_PATH="/bin/rsync" RSYNC_PATH="/bin/rsync"
 </code> </code>
  
 In the above, SSH is used to set the login details for the connection and RSYNC_PATH set to the target rsync binary. In the above, SSH is used to set the login details for the connection and RSYNC_PATH set to the target rsync binary.
 +
 +By default the backup process will login as user rsync and use the setuid binary found in the rsync home directory. This will allow a full host backup.
  
 ^ Variable ^ Usage ^ Default ^ ^ Variable ^ Usage ^ Default ^
Line 86: Line 124:
 |RSYNC_PATH  | rsync command line | /home/rsync/bin/rsync | |RSYNC_PATH  | rsync command line | /home/rsync/bin/rsync |
  
-By default the backup process will login as user rsync and use the setuid binary found in the rsync home directory. This will allow a full host backup.+When backing up the localhost, just use the hostname and rsync will copy files directly rather than use ssh.
 === Purge === === Purge ===
  
 After each backup operation a directory purge is performed to remove old directories. This can remove temporary data within a backup period and this should be appreciated. After each backup operation a directory purge is performed to remove old directories. This can remove temporary data within a backup period and this should be appreciated.
 +
 +Purging can be disabled if preferred but exists to manage the number of directories over time. A weekly backup to tape or external disk storage would be sensible for important data.
  
 ==Rules== ==Rules==
Line 106: Line 146:
  
 To disable the purge process, set the PURGE variable to "" in the config. To disable the purge process, set the PURGE variable to "" in the config.
 +
 +
 +=== Export ===
 +
 +[[:projects:rsyncbackup?do=export_pdf|PDF]]
 +