backup-local | backup | backup-rsync | backup-upload | encryption
beware of symlinks
— the target folders defined in backup.lst
must not be symlinks (parent folder being a symlink is ok)
debian/ubuntu
apt install ksh lftp # (optional) in case you want GnuTLS instead of OpenSSL apt purge gnupg2 gnupg apt install gnupg1
slackware
slackpkg search ksh93 slackpkg search lftp
netbsd
(PDKSH built-in) pkg_info | grep lftp
keep a copy of the key some place outside the server you wanna backup
mkdir -p /data/backup/ vi /etc/backup.conf
backupdir=/data/backup maxold=5 secret="SYMMETRIC-KEY-HERE" # rsync, ftp or none method=none #uploaddir=/data/backup # Dedibackup FTP #server=FTP-SERVER #user=auto #pass="" # rsync through ssh #rsyncdest=SSH-SERVER:/path/to
chmod 600 /etc/backup.conf
define the folders you wanna backup
vi /etc/backup.lst /etc /root /var chmod 600 /root/backup.lst
attempt a manual backup first
# https://pub.nethence.com/bin/backup/backup.ksh.txt time nice /root/backup.ksh
eventually check that this is multi-core capable (>100%
)
top -b | grep ssl top -b | grep gpg
check for the resulting files
ls -lhF /data/backup/
attempt to restore from an encrypted archive
cd /data/backup/ # https://pub.nethence.com/bin/backup/backup-decrypt.ksh.txt time nice /root/backup-decrypt.ksh 2024-01-21-07-49-35.etc.tar.lz4.camellia
and eventually check the content of every archive sample, just to make sure you truly got the folder content, in case it’s a symlink
finally enable the job every night as a priviledged cron job as follows
vi /etc/daily
vi /root/DAILY time nice /root/backup.ksh #time nice /root/backup-upload.ksh
crontab -e 00 04 * * * time nice /root/backup.ksh #00 04 * * * time nice /root/backup.ksh; time nice /root/backup-upload.ksh
lftp user credentials do not work with -e or -c https://unix.stackexchange.com/questions/469787/lftp-user-credentials-do-not-work-with-e-or-c
Mirror copying hidden (dot) files regardless. #251 https://github.com/lavv17/lftp/issues/251 –> or consider yafc instead?
How to use tar with lz4? https://stackoverflow.com/questions/24063846/how-to-use-tar-with-lz4