FG

How do I password protect a .tgz file with tar in Unix?

Fresh3 days ago
Mar 15, 2026194573 views
Confidence Score1%
1%

Problem

I'm using the Unix tar command as follows to tar up a directory and its files: Is there a way to password protect the .tgz file? I've created password-protected ZIP files on Windows so I would assume Unix has the same capability. Any ideas?

Error Output

tar cvzf fileToTar.tgz directoryToTar

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I password protect a .tgz file with tar in Unix?

Low Risk

Use or on the file. Simple examples:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment