使用tar使用密码压缩tar.gz文件 [英] Use tar to compress file tar.gz with password
问题描述
我使用 tar -czf test.tar.gz test/
将 test
forlder压缩为 test.tar.gz
.现在,我想用密码"mypass"
压缩到 test.tar.gz
,该怎么办?
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?
推荐答案
tar格式
和 gz格式
都没有内置的密码保护文件支持.
在
上使用crypt或gpg请参考加密-并使用密码解密文件以获取更多信息.
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
或
ccrypt backup.tar.bz2
您也可以使用zip
You can also use zip
zip -e file.zip file
将在提示您询问密码时询问您.然后,通过 zip -P password
通过命令行传递密码会更加安全.
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
.
这篇关于使用tar使用密码压缩tar.gz文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!