ZIP is a very popular compression and file packaging utility for Unix-like operating systems as well as Windows. While perusing through the zip man page, I discovered some useful options for protecting zip archives.
First, install zip utility in your Linux distribution using the package manager as shown.
$ sudo yum install zip [On CentOS/RHEL] $ sudo dnf install zip [On Fedora 22+] $ sudo apt install zip [On Debian/Ubuntu]
How to Create Password Protected ZIP in Linux
Once installed, you can use the zip command with -p flag to create a password protected zip archive called ccat-command.zip from the directory of files called ccat-1.1.0 as follows.
$ zip -p pass123 ccat-command.zip ccat-1.1.0/
However, the above method is absolutely insecure, because here the password is provided as clear-text on the command line. Secondly, it will also be stored in the history file (e.g ~.bash_history for bash), meaning another user with access to your account (more especially root user) will easily see the password.
Therefore, try to always use the -e flag, it shows a prompt allowing you to enter a hidden password as shown.
$ zip -e ccat-command.zip ccat-1.1.0/
How to Unzip Password Protected ZIP in Linux
To unzip and decrypt the content of the archive file called ccat-command.zip, use the unzip program and provide the password you entered above.
$ unzip ccat-command.zip