Password Protect Tar.gz File May 2026
The tar and gzip utilities do not have built-in support for password protection. To secure a .tar.gz file, you must use an additional encryption tool like GnuPG (GPG) or OpenSSL. Method 1: Using GnuPG (Symmetric Encryption)
There are a few methods to password protect a tar.gz file: password protect tar.gz file
4. The tar Password Myth
You may find old forum posts suggesting tar -cf archive.tar --password=123 files/. This does not exist in GNU tar. Some proprietary Unix versions (like older Solaris) had this feature, but it is not portable. Do not rely on it. The tar and gzip utilities do not have
If you prefer a more robust encryption standard often used for emails and signing, GPG is the gold standard. To Encrypt: The tar Password Myth You may find old
Method 1: Using tar and gzip
You can use the tar and gzip commands to create a tar.gz file and then encrypt it with a password using openssl.
: This uses a single passphrase to both encrypt and decrypt the file. gpg -c file.tar.gz