具有最高加密的 7z 命令行:AES-256 + 加密文件名

Wub*_*gee 21 file-roller 7zip

我有一个问题。我试图备份和加密文件,但使用更新的 aes256 或 aes512 加密。

1)听说7z默认是aes128,我想用最好的(aes256...我觉得?),我该怎么做?

这是我的命令:

cd /mnt/MyBackupHardDrive ;

7z a MyFullComputerBackup-AES256.7z -t7z -m0=lzma2:d1024m -mx=9 -aoa -mfb=64 -md=32m -ms=on /home/MyHomeDirectory
Run Code Online (Sandbox Code Playgroud)

2)这是否也会自动加密文件名?

谢谢你的尽心帮助!

and*_*.46 44

可以使用 7z 获得 AES 256 加密,并使存档和文件名仅在使用密码短语时可见。我注意到您自己的命令行中缺少重要的“密码”选项。

一个例子,我从手册页中大量借用了它:

7z a \
  -t7z -m0=lzma2 -mx=9 -mfb=64 \
  -md=32m -ms=on -mhe=on -p'eat_my_shorts' \
   archive.7z dir1
Run Code Online (Sandbox Code Playgroud)

稍微更安全的方法是实际将该-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
Run Code Online (Sandbox Code Playgroud)

测试存档:

可以使用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$ 
Run Code Online (Sandbox Code Playgroud)

请注意对密码的调用以及加密为7zAES:19 aka AES-256的符号(为了清楚起见,我用箭头标记了这些点)。

注意事项:

  1. 请注意,在手册页中,有一个针对在 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.
    
    Run Code Online (Sandbox Code Playgroud)
  2. 还要注意手册页中给出的关于在 Linux 下备份目录的一些限制和变通方法......