可以使用7z获得AES 256加密,并使存档和文件名仅在使用密码的情况下可见。我注意到,您自己的命令行中缺少重要的“ passphrase”选项。
我从手册页中大量借用了一个示例:
7z a \
-t7z -m0=lzma2 -mx=9 -mfb=64 \
-md=32m -ms=on -mhe=on -p'eat_my_shorts' \
archive.7z dir1
一种更安全的方法是将-p
字段保留为空白,然后7z会提示您在实际创建存档之前输入密码。
说明:
以下是对7z命令行不熟悉的用户的解释:
a Add (dir1 to archive.7z)
-t7z Use a 7z archive
-m0=lzma2 Use lzma2 method
-mx=9 Use the '9' level of compression = Ultra
-mfb=64 Use number of fast bytes for LZMA = 64
-md=32m Use a dictionary size = 32 megabytes
-ms=on Solid archive = on
-mhe=on 7z format only : enables or disables archive header encryption
-p{Password} Add a password
测试档案:
可以使用7z l -slt archive.7z
下面演示的命令来测试后续存档:
andrew@illium~/test$ 7z l -slt archive.7z
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)
Scanning the drive for archives:
1 file, 12919 bytes (13 KiB)
Listing archive: archive.7z
Enter password (will not be echoed): <-------------
--
Path = archive.7z
Type = 7z
Physical Size = 12919
Headers Size = 247
Method = LZMA2:14 7zAES
Solid = -
Blocks = 1
----------
Path = dir1
Size = 0
Packed Size = 0
Modified = 2017-06-23 14:10:59
Attributes = D_ drwxr-xr-x
CRC =
Encrypted = -
Method =
Block =
Path = dir1/200px-Aum_calligraphy.svg.png
Size = 12663
Packed Size = 12672
Modified = 2015-05-06 07:29:23
Attributes = A_ -rw-r--r--
CRC = 77BD9922
Encrypted = + <-------------
Method = LZMA2:14 7zAES:19 <-------------
Block = 0
andrew@illium~/test$
请注意要求输入密码以及表示加密为7zAES:19或AES-256的符号(为清楚起见,我用箭头标记了这些要点)。
注意事项:
请注意,在手册页中有一个特定的警告,禁止在Linux下使用7z进行存档:
DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
- 7-zip does not store the owner/group of the file.
还要注意手册页中有关在Linux下备份目录的一些限制和解决方法...。