$ tar cz folder_to_encrypt | openssl enc -aes-256-cbc -e > out.tar.gz.enc

or

$ gpg --encrypt out.tar.gz

the “gpg -c” command by default does compression before encryption or use 7z

Generating GPG Keys

$ gpg --gen-key
$ gpg --export --armor Zee
$ gpg --export-secret-keys --armor Zee
$ gpg --export --armor Zee

Decrypt

$ gpg --output ./backup.sql --decrypt ./backup.sql.gpg

References

TAR with GPG Encryption

Leave a Reply

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