Backup server using rsync
Original Question or Issue:
How to use a dedicated user to backup FileCloud using rsync. Also, how to automate the jobs.
Environment:
- Product - FileCloud Backup server
- Version - Any
- Platform - Linux
Steps to Reproduce:
New configuration.
Error or Log Message:
Defect or Enhancement Number:
Cause:
Resolution or Workaround:
-
Create a new account in the FileCloud target server and add it to the www-data group: useradd bkpuser -g www-data; passwd bkpuser
-
Create the same account in the Backup server:
useradd bkpuser; passwd bkpuser -
Connect with this new user to the Backup server and generate SSH keys:
ssh-keygen -
Run the following command to copy SSH keys from backup to the target server:
ssh-copy-id bkpuser@target.filecloud -
Copy the SSH private key to a location where the www-data can access it:
cp /home/bkpuser/.ssh/id_rsa /backup/
chown www-data:www-data /backup/id_rsa
Notes:
Regarding automatic backup and cleanup, you should set up cron jobs for the www-data user at the FileCloud backup server: crontab -u www-data -e
# Full backup each Friday:
00 01 * * 5 /usr/bin/php /var/www/html/app/backupserver/backupcron.php --command=backupnow --targetname=myfilecloud --incremental=0
# Incremental for remaining days:
00 01 * * sun,mon,tue,wed,thu,sat /usr/bin/php /var/www/html/app/backupserver/backupcron.php --command=backupnow --targetname=myfilecloud --incremental=1
# Delete old backups > 7days
00 06 * * 6 /usr/bin/php /var/www/html/app/backupserver/backupcron.php --command=deleteold --targetname=myfilecloud --daysold=8