Password Protected ZIP File in Linux
Create an encrypted ZIP file secure.zip
from some file:
$ zip --encrypt secure.zip file Enter password: Verify password: adding: file (deflated 8%)
Create password protected ZIP archive secure.zip
from the several files:
$ zip --encrypt secure.zip file1 file2 file3 Enter password: Verify password: adding: file1 (stored 15%) adding: file2 (deflated 30%) adding: file3 (deflated 45%)
Create an encrypted ZIP archive secure.zip
from a folder /var/log/
:
$ zip --encrypt -r secure.zip /var/log/ Enter password: Verify password: adding: var/log/ (stored 0%) adding: var/log/dmesg.0 (deflated 74%) adding: var/log/dpkg.log.9.gz (deflated 0%) adding: var/log/samba/log.asc-nb (deflated 96%) ***
Use the following command to uncompress a ZIP file:
$ unzip secure.zip Enter password: ***
Encrypt and Decrypt ZIP Archive in Linux
You were interactively prompted for the password in the examples above.
If you want to create a password protected ZIP file from some shell script, you may want to do it non-interactively.
You can easily encrypt and decrypt ZIP files from the Linux command line without being prompted for the password.
Do it as follows:
$ zip -P passw0rd secure.zip file $ zip -P passw0rd secure.zip file1 file2 file3 $ zip -P passw0rd -r secure.zip /var/log/
Uncompress a password protected ZIP archive:
unzip -P passw0rd secure.zip
Refferensi :
https://www.shellhacks.com/create-password-protected-zip-file-linux/