Password Protect Tar.gz File May 2026
#!/bin/bash # Usage: ./secure-tar.sh <directory> <output_name> if [ $# -ne 2 ]; then echo "Usage: $0 <source_dir> <output_base_name>" exit 1 fi
By adding a password through or GPG , you transform that cardboard box into a steel safe. The process takes only a single extra command, but the security gains are immeasurable. password protect tar.gz file
Now go ahead: password protect your tar.gz files. Your data—and your peace of mind—will thank you. Your data—and your peace of mind—will thank you
OpenSSL is a robust, cryptography-grade toolkit found on virtually every Linux distribution, macOS, and even Windows (via WSL or Git Bash). It uses military-grade AES (Advanced Encryption Standard) encryption. Assume you already have a file called backup.tar.gz . To password protect it, you will encrypt it into a new file. Assume you already have a file called backup
if [ $? -eq 0 ]; then echo "Success: $OUTPUT_BASE.tar.gz.enc created." echo "To extract: openssl enc -d -aes-256-cbc -in $OUTPUT_BASE.tar.gz.enc | tar xzf -" else echo "Encryption failed." exit 1 fi