dark

Backup to free Hetzner FTP

blank

If you have a hosting account at Hetzner with free backup space, you can not access this backup volume using rsync.

One way of creating a simple backup, is by using the tar command with the incremental option.

You will also want to encrypt these backup files and one easy to do this, is by using GPG keys.

The following example assumes you have logged on the FTP server before and that you have created a backup subdirectory.
It also uses the ncftp tool.

#!/bin/bash

DIRS="/etc /root /home /var/cache/bind /var/spool/postfix /var/www"
INCFILE="/root/.backup/inc_file"
CURRENT_DATE=$(date '+%Y%m%d')
DSTFILE="/data/backup/backup-$CURRENT_DATE.gpg"
GPGUSER="gpg@localhost"
HETZNERUSER=ftpuser
HETZNERPASS=secret
HETZNERSERVER=ftpuser.your-backup.de
HETZNERDIR=backup

tar cvzg $INCFILE -f - $DIRS | gpg -r $GPGUSER -e > $DSTFILE
ncftpput -DD -u $HETZNERUSER -p $HETZNERPASS $HETZNERSERVER $HETZNERDIR $DSTFILE

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Previous Post

Check if a NFS share is mounted

Next Post

Recursive Inotify Daemon

Related Posts