Create encrypted .tar.gz archives.
- Python 3.5+
- python-gnupg
- Create .tar.gz archives encrypted with GPG.
- Use symmetric or asymmetric encryption.
- Backup directories defined in a config file.
-
Clone the repository.
-
Run
python create-backup.py
to create a new config file:[SETTINGS] recipients = ["[email protected]"] gnupghome = "/home/user/.gnupg" [CRITICAL] directories = [ "/home/user/.password-store", "/home/user/.gnupg" ] [IMPORTANT] directories = [ "/home/user/Pictures", "/home/user/Documents" ] [NON_ESSENTIAL] directories = [ "/mnt/hdd/large-files", "/mnt/hdd/movies" ]
-
Edit the values for your own use.
Put your GPG email in the recipients field.
There are three levels, critical, important and non-essential.
- Critical is meant for files that absolutely cannot be missed, such as passwords. Mostly small files.
- Important is for non-critical but still important and irreplaceable files, such as documents, pictures, etc.
- Non-essential is meant for things that can be retrieved in some way, like movies, music, books, and downloads. Mostly large files.
-
Run
python create-backup.py
and supply the arguments you need. Example:python create-backup.py -c
would create backup file/tmp/backup-<date>.tar.gz.gpg
, containing only critical files.python create-backup.py -c -i -n
would create a backup file containing critical, important and non-essential files.python create-backup.py -c --symmetric
creates a backup file using symmetric encryption. You will be asked to choose a password.
-
The backup is now complete.
You can decrypt the resulting file using
gpg --output <filename>.tar.gz --decrypt <archive_name>.tar.gz.gpg
. Optionally append& progress -mp $!
to that command to show progress.