Remote encrypted backup using gpg and s3

After 10 years with rsync.net, time has come to move to a different secure remote storage.

The shell script to encrypt and upload gets a refresh as well, and syncs to Amazon S3 (not exactly a secure storage btw).

#! /bin/bash

GPG_DEST="[email protected]"
DOC_ROOT="$HOME/Documents"
AWS_BUCKET="secure-vault-eu-west-1"

echo "Start encryption..."

find . -iname '*[pdf|xls|csv]' -exec echo '{}' \; | while read f
do

    if [ -f "$f" ] && [ ! -f "$f".gpg ]; then

        gpg -e -r $GPG_DEST "$f"

        touch -r "$f" "$f".gpg

    fi

done

echo "Start upload..."

aws s3 sync --exclude "*" --include "*.gpg" $DOC_ROOT s3://$AWS_BUCKET

echo "Finished."

Edit: I will stay with rsync.net. The guys are cool and we both agreed to review the terms and conditions, but more than this, their service is still awesome.

Leave a Reply

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