1.命令作用
zipcloak默认操作是加密zip文件中所有未加密的条目(the default action is to encrypt all unencrypted entries in the zip file)。
2.命令语法
Usage: zipcloak [-dq] [-b path] zipfile
3.参数详解
- -d --decrypt,解密或加密条目(如果给出错误的密码则复制)
- -b --temp-path,使用path路径作为临时存放zip文件的目录,可提高大文件加密解密的效率和稳定性
- -O --output-file,加密并输出写入到新的zip文件;源文件保留,复制成新压缩文件并加密
- -q --quiet,安静操作,抑制部分提示信息
4.常用用例
4.1.常规加密
## 执行后输入密码,再次输入密码,对zip归档压缩文件内的所有文件进行加密
[root@node2 Desktop]# zipcloak a.zip
Enter password:
Verify password:
encrypting: file4.txt
encrypting: file5.txt
encrypting: file6.txt
encrypting: file7.txt
encrypting: file8.txt
encrypting: file9.txt
[root@node2 Desktop]#
## 如果已经加密,会有相关提示
[root@node2 Desktop]# zipcloak a.zip
zipcloak error: Nothing to do! (all files encrypted already)
[root@node2 Desktop]#
4.2.常规解密
## 指定-d参数,然后输入密码进行解密
[root@node2 Desktop]# zipcloak -d a.zip
Enter password:
decrypting: file4.txt
decrypting: file5.txt
decrypting: file6.txt
decrypting: file7.txt
decrypting: file8.txt
decrypting: file9.txt
[root@node2 Desktop]#
## 如果没有加密的文件进行解密会提示相关信息
[root@node2 Desktop]# zipcloak -d a.zip
zipcloak error: Nothing to do! (no encrypted files)
[root@node2 Desktop]#
4.3.加密为新文件
## 将z.zip复制成a_bak.zip,然后对a_bak.zip进行加密
[root@node2 Desktop]# zipcloak -O a_bak.zip a.zip
Enter password:
Verify password:
encrypting: file4.txt
encrypting: file5.txt
encrypting: file6.txt
encrypting: file7.txt
encrypting: file8.txt
encrypting: file9.txt
[root@node2 Desktop]#
[root@node2 Desktop]# ll a*.zip
-rw-------. 1 root root 1081 Mar 9 14:12 a_bak.zip
-rw-r--r--. 1 root root 1009 Mar 9 14:12 a.zip
[root@node2 Desktop]#
## 检测发现a.zip未加密,a_bak.zip已经加密
[root@node2 Desktop]# zipcloak a.zip
Enter password:
zipcloak error: Interrupted (aborting)
[root@node2 Desktop]# zipcloak a_bak.zip
zipcloak error: Nothing to do! (all files encrypted already)
[root@node2 Desktop]#