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?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With