How to configure: Remote backup Rsync over SSH (with key authentication) - ModMasterPro/DirectAdmin-Backup-Manager GitHub Wiki

How to configure: Remote backup Rsync over SSH (with key authentication)

Before you begin

Check if you have rsync installed on your Directadmin and backup servers. Install it if missing.
$which rsync
To install you can use
CentOS yum:
sudo yum install rsync -y
Ubuntu apt-get
sudo apt-get update && apt-get install rsync
Verify install
$which rsync
/usr/bin/rsync
$rsync --version
rsync version 3.1.2 protocol version 31

To copy SSH key from Directadmin server to your backup server from settings page you need to have sshpass tool on your Directadmin server (skip this step if you want to install public key manually):
$which sshpass
Install it if missing:
CentOS yum: from EPEL repository
Install EPEL repository if missing
sudo yum -y install epel-release
Install sshpass:
sudo yum install sshpass -y --enablerepo=epel
Ubuntu apt-get
sudo apt-get update && apt-get install sshpass
Verify install
$which sshpass
/usr/bin/sshpass

If you have firewall running on your Directadmin server, make sure you allow to open outgoing connections to your backup server or IP is whitelisted. Verify connection to your backup server
ssh -p <ssh port> <ssh username>@<backup server name or IP>
or using key file
ssh -p <ssh port> -i /usr/local/directadmin/plugins/backup_manager/.ssh/bmkey <ssh username>@<backup server name or IP>

Plugin install

Step 1
Login Directadmin and click on plugin manager
Login Directadmin and click on plugin manager

Step 2
Click Add
Click Add

Step 3
Enter password and click install
Enter password and click install
Use the link:
https://download.modmaster.pro/directadmin/backup_manager/backup_manager.tar.gz
Enter password and click install

Step 4
Click configure
Click configure

Plugin settings

Enable backup - Set Yes to enable
User access - Set Yes to enable user access to backups.
Server address - Backup server IP or address.
Port - SSH port
Username - SSH username
Authentication method - Public key
Connection mode - Remote shell
I/O timeout - Leave it default and increase on slow connection to backup server.
Compress level - Leave it default or adjust according to your needs.
Backup schedule - A crontab style strung. For example: 15 1 * * * backup everyday at 1:15 am.
Cache requests - Cache requests on files listing.
Use run file - Helps to avoid of running more than one backup task. If user home folder too big we suggest to turn it on for the first backup.
Backup folder - Path to backup folder on your backup server.
Backup days - Number of backups to keep.
Our public key - Our public key to copy to your backup server. Click Generate new key if filed is empty or you want to get new key.

Backup manager Remote settings page

SSH key

Install with sshpass from settings page

  1. Click Generate new key if filed is empty or you want to get new key.
  2. Click Copy key to remote server
  3. Enter remote backup user password
  4. Click **OK
    Backup manager Install with sshpass from settings page
    Click Check connection to verify your settings.

Manual install

  1. Click Generate new key if filed is empty or you want to get new key.
  2. Click Copy key into clipboard
  3. Login to your backup server
  4. Use your favorite editor to add the key. (# nano /home/backup username/.ssh/authorized_keys).
    Click Check connection to verify your settings.

Backup manager remote connection success

Run backup manually

To run remote backup manually:
/usr/local/directadmin/plugins/backup_manager/scripts/cron.php rbackup daily

Possible issues

Fix permissions:
sh /usr/local/directadmin/plugins/backup_manager/scripts/fixperm.sh

⚠️ **GitHub.com Fallback** ⚠️