Hero Image

Useful tips

How to password protect gzip files on the command line?

With openssl and tar

Encrypt

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

Decrypt

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

With zip and unzip (less secure)

Encrypt

zip -r --encrypt archive.zip folder_to_encrypt

Decrypt

unzip archive.zip

Encrypt one file

Encrypt

openssl enc -aes-256-cbc -salt -pbkdf2 -e -in filename.doc -out filename.enc

Decrypt

openssl enc -aes-256-cbc -salt -pbkdf2 -d -in filename.enc -out filename.doc