Encrypt First

Story: How to Set Up an Automatic Backup System on Linux with Dropbox Total Replies: 0
Author Content
dotmatrix

Apr 05, 2017
8:42 AM EDT
There's a link in the article that shows a few options for encrypting the archive file before uploading it to Dropbox.

However, I didn't see GPG listed... so, if someone is interested in using GPG... I would modify the cron line to run this script... Of course, change filenames or locations as needed or wanted.

#!/bin/bash
# Script will create an tar archive and then encrypt that archive with the hardcoded PGP key.
#   After encryption, the archive file will be uploaded to a Dropbox account.
#   A specific PGP subkey can be used by appended a ! at the end of the keyid.

_filename=backup-$(date +%Y-%m-%d).tar.gz tar -zcvf $_filename /home/username/files-or-folders-to-back-up/ gpg --trust-model always -o $_filename.asc -r gpg_public_key -e $_filename

#To use a specific PGP subkey #gpg --trust-model always -o $_filename.asc -r keyid! -e $_filename

/home/username/Dropbox-Uploader/dropbox_uploader.sh upload $_filename.asc Linux-Backup


I generally don't embed scripts in my crontab. I find it more organized and a bit easier to understand and work with if I place my crontab scripts in a separate Bash script location and run those from cron. That way I don't need to edit the crontabs... I can simply edit the scripts directly.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!