Linux Commands

How to Create a Password-protected Zip File on Linux

Our data is becoming increasingly difficult to keep safe in today’s world. Also, we make many efforts to keep our data secure in every respect, so that it remains safe at all times. We can make the password protected section the easiest thing to do. We can keep the data secure by using a password we know only. With Zip, Linux users can decompress a password and compress a file. ZIP comes with no built-in command; we need to install this from an external source. The zip command can be executed by both Zip and Unzip.

Creating password-protected zip files in Linux can be done by many different methods.

By Command-line Method

In order to use this method, we must verify that zip support is enabled on our Linux system.

Install the zip file using the distribution’s package manager. When it does not exist in the system, it automatically installs the zip file.

To install a Zip, unzip the file in the Ubuntu system. We need to run the command given below.

sudo apt install zip unzip

Making a zip file is very similar to this process. Only the encryption option is different, which is option -e.

zip -re
file1 folder1

The -r stands for recursively looking into directories in the above command, and e is used for encryption.

After this, our system will ask us to enter or verify the password. It is not necessary that the password type appears on the screen and which is normal.

For this, we have to type the password and enter it twice. This process is completed here, and after that, if someone unzips the file, he can see the contents of the files, but he cannot read the files.

By GUI Method

So, here is another method by which we can create a password-protected zip file in Linux. These are some steps by following which we can create password-protected zip files with the GUI method.

Step 1: First, we have to open the archive manager in our system by searching it.

Step 2: After that, we have to drag and drop the file we want to compress into a zip file and then choose the Create Archive option.

Step 3: Finally, we choose the type of compressed file. This file will be a .zip. Then we will see “Other options,” by clicking on it, we have to field the password. We can enter the desired password as per our requirements and click on the Save button.

With this method, we can successfully create a password-protected zip file graphically in Ubuntu Linux. Next time we want to remove this file, it will ask for a password.

How to Remove Password-protection Zip Files

Using the terminal application, we will go about the file using the first command, “ls.”

In the following command, we will use “unzip ” here; test2 is the file whose password must be removed.

Now we will enter the password in it, and we will find that our zip file, which we password-protected, has been password removed.


We hope that the methods discussed in the above article will be helpful to you. You will be able to understand how to protect zip files properly after reading this article. We also included the way to remove password-protection zip files on Linux.

About the author

Ankit Sharma