You will be prompted for the password. The unencrypted data streams directly to tar .
Here’s a little secret: A tar.gz file is not the only archiving format. The .zip format has supported password-based AES encryption for years. While you lose some of the Unix-specific perks of tar (like preserving exact ownership and symlinks), the zip command can directly compress and encrypt a folder. password protect tar.gz file
– Avoid writing passwords in scripts or shell history. Use read -s to prompt securely. You will be prompted for the password
7z a -pthepassword -mhe=on -t7z secure.7z /path/to/folder password protect tar.gz file