delicious

Answer: How to password protect gzip files on the command line?

A murb'ed feed, posted more than 7 years ago filed in encryption, openssl, secure, command line, terminal & linux.

tl;dr:

Symetric (OpenSSL)

Encrypt:

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

Decrypt:

$ openssl enc -aes-256-cbc -d -in out.tar.gz.enc | tar xz

This is for example how I make a secure postgresql dump: pg_dump database-name | gzip | openssl enc -aes-256-cbc -kfile .backuppassphrase -e > "db_backups/dump.psql.gz.enc" and extract it with: openssl enc -aes-256-cbc -d -in dump.psql.gz.enc | gzip -d > dump.psql

Asymetric (gpg)

Encrypt:

$ gpg --encrypt out.tar.gz

Decrypt:

$ gpg --decrypt out.tar.gz

Go to the original link.