Skip to content

Instantly share code, notes, and snippets.

@jhyland87
Created July 3, 2018 19:37
Show Gist options
  • Save jhyland87/2785daf96ac9fc876bf53e6f69f44c60 to your computer and use it in GitHub Desktop.
Save jhyland87/2785daf96ac9fc876bf53e6f69f44c60 to your computer and use it in GitHub Desktop.
Generate a GZIP compressed TAR archive thats AES-256 encrypted and password protected
# Create encrypted folder with password specified in the command (CHANGEME)
tar cz -P -C ./data ./ | openssl enc -aes-256-cbc -salt -pass "pass:CHANGEME" -a -A -e -out encrypted-compressed-archive.tar.gz.enc
# Decrypt above file
openssl enc -aes-256-cbc -a -A -d -pass "pass:CHANGEME" -in ./encrypted-compressed-archive.tar.gz.enc | tar xz -C ./data
# Same thing as the above, but password isn't specified (which means the password will be requested)
tar cz -P -C ./data ./ | openssl enc -aes-256-cbc -salt -a -A -e -out encrypted-compressed-archive.tar.gz.enc
openssl enc -aes-256-cbc -a -A -d -in ./encrypted-compressed-archive.tar.gz.enc | tar xz -C ./data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment