Differences
This shows you the differences between two versions of the page.
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. | ||
< | < | ||
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 / | ||
+ | |||
+ | The backup directory can be changed prior to install by editing the SYNCDIR variable in the file bin/config | ||
< | < | ||
sudo make install-server | sudo make install-server | ||
+ | </ | ||
+ | |||
+ | __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: | ||
+ | |||
+ | < | ||
+ | sudo -s | ||
+ | /bin/su - rsync | ||
</ | </ | ||
== 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. | ||
< | < | ||
Line 34: | Line 60: | ||
</ | </ | ||
+ | __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 |
==Variables== | ==Variables== | ||
Line 43: | Line 79: | ||
^ Variable ^ Usage ^ Default ^ | ^ Variable ^ Usage ^ Default ^ | ||
- | |ETCDIR | + | |ETCDIR |
|SYNCDIR | |SYNCDIR | ||
|RSYNC | |RSYNC | ||
|PURGE | |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: | ||
< | < | ||
#! /bin/bash | #! /bin/bash | ||
- | SSH=" | + | SSH=" |
RSYNC_PATH="/ | RSYNC_PATH="/ | ||
</ | </ | ||
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_PATH | ||
- | By default | + | 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 "" | To disable the purge process, set the PURGE variable to "" | ||
+ | |||
+ | |||
+ | === Export === | ||
+ | |||
+ | [[: | ||
+ | |||