How To Create A Password Protected Zip File In Linux

In this article, we will explain how to Create A Password Protected Zip File or Encrypted Zip file in Linux. We will also briefly explain how to install the zip package in Ubuntu.

Password protected
encrypt zip file

There are several ways you can encrypt zip files in Linux. Let’s see how one can protect a zip file by using the zip command itself.

Create a password protected zip file in Linux

You could use either the zip command to create a zip file with password protected or the GUI to do the same.

Command Line Method

First thing first, make sure that you have zip support enabled in your Linux system. Use your distribution’s package manager and try to install it. If its not installed already, it will be installed.

We could use the following command in Debian/Ubuntu to install zip package:

 sudo apt install zip unzip

Now let’s say if you want to create a zip file, you can use the following command in any Linux based environment with the zip utility.

zip -r files.zip file1.txt file2.txt

So the above command creates a zip file called files.zip which contains the files file1.txt and file2.txt.

Now let’s create the same file with a password, which means the files.zip will be encrypted and so you won’t be able to access it without a password.

zip -re files.zip file1.txt file

So here
-r is used to zip the files recursively
-e is used to encrypt the zip file

So after entering the above command, you will be prompted to enter the password and as well for confirming the password. If you are at this step means, you have successfully created the password-protected zip file.

Add a Comment

Your email address will not be published. Required fields are marked *