Create an encrypted 7zip archive with encrypted header as well (no filenames are visible)
In case you come to a scenario where you need to encrypt, password protect the contents of a
7zip archive and make sure that not even the filenames of the contents are visible,
7zip has your back! As you can see in the following example you can implement the above requirements very easily.
7z a -p"pbVfdPs27Dc" -mhe hello.7z file1.bin file2.doc files.*
The structure of the above 7z command is the following:
#Based on: 7z <command> [<switches>...] <archive_name> [<file_names>...] 7z a -p"Some [email protected]" -mhe <archive_name> [<file_names>...]
To break it down, it goes like this:
- We used the
a, which instructs the tool to add the listed files to the listed archive (if the archive does not exist, it will create it).
-p, allows you to set the password for the archive.
- The second
-mhe=on) it enables data and header archive encryption.
In case you cannot find this switch at the manual, check the examples in the
manpage (This command works on GNU/Linux, it was tested on Fedora).