How to Create a Password Protected ZIP File in Linux

1. Create a ZIP file:

First, create a ZIP file of the files you want to protect. To do this, open a terminal window and navigate to the directory containing the files you want to protect. Then, run the following command:

zip -r protected.zip *

This will create a ZIP file called “protected.zip” containing all the files in the current directory.

2. Set a password:

Next, set a password for the ZIP file. To do this, run the following command:

zip -e protected.zip

This will prompt you to enter and confirm a password for the ZIP file.

3. Verify the password:

Finally, verify that the password is working by trying to open the ZIP file. To do this, run the following command:

unzip protected.zip

This will prompt you to enter the password you set earlier. If the password is correct, the ZIP file will be extracted. If the password is incorrect, the ZIP file will remain encrypted.

Create password protected zip and unzip files in Linux; Through this tutorial, we will learn how to create password protected zip files and directories in Linux system using a terminal and GUI.

Sometimes what happens to us is that our files and directories are in zip format. And We have to password protect them. So that no one can unzip those zip files without password.

Commands are given for zip and unzip in Linux system. Using this we can password protected zip and unzip any file and directory.

We know that the first method can be password protected zip and unzip files and directories using the command line. And there is another way we can use graphical user interface to password protected zip and unzip files and directories.

How to Create a Password Protected ZIP File in Linux

There are 2 ways to create password protected zip and unzip files and directories. Which are given below:

  • Create Password Protected Zip using Terminal
  • Create Password Protected Zip using GUI

Create Password Protected Zip using Terminal

Before we create password protected zip file, we need to install the zip and unzip packages into our Linux system by using the following command:

sudo apt install zip unzip

Next, create a zip archive with a password by using the following command:

zip --encrypt test1.zip test1

Then prompt will be open for enter the password as shown below:

Enter password: 
Verify password: 

Finally, using the following command to try to unzip the password-protected zip file, as above created:

unzip test1.zip

Then prompt will be open to enter password for unzip the file:

Archive:  test1.zip
[test1.zip] test1 password: 

Create Password Protected Zip using GUI

Now, use the following steps to create zip using GUI; as following:

  • Step 1: Visit the file location
  • Step 2: Right-click on the file
  • Step 3: Click on the compress option
  • Step 4: Then click on the other option and set your password and click on Create option

Conclusion

Through this tutorial, we have learned how to create password protected zip files and directories in Linux system using a terminal and GUI.

Recommended Linux Ubuntu Tutorials

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?