I use tar -czf test.tar.gz test/
to compress test
forlder to test.tar.gz
. Now, I want compress to test.tar.gz
with password "mypass"
How can I do?
Asked
Active
Viewed 6.7k times
18
-
1https://superuser.com/questions/162624/how-to-password-protect-gzip-files-on-the-command-line – Denis Apr 06 '19 at 13:46
1 Answers
29
Neither the tar format
nor the gz format
has built-in support for password-protecting files.
Use crypt or gpg on the
Refer this encrypt-and-decrypt-files-with-a-password for more info.
tar cvvjf - /path/to/files | ccrypt > backup.tar.bz2.cpt
or
ccrypt backup.tar.bz2
And then to decrypt:
cat ../backup.tar.bz2 | ccrypt -d | tar -xjf -
You can also use zip
zip -e file.zip file
Will ask you on a prompt for a password. It is more secure then passing the password via the command line via zip -P password
.

falsePockets
- 3,826
- 4
- 18
- 37

Santosh A
- 5,173
- 27
- 37
-
1But I want enter password on my compress command. Can you help me with this? – abent Jul 14 '14 at 10:20
-
9
-
https://superuser.com/questions/162624/how-to-password-protect-gzip-files-on-the-command-line – Denis Apr 06 '19 at 13:46