How to Create Password Protected ZIP Archives on Ubuntu

By | August 15, 2020

Password Protected Zip Files

Often times we need to create secure zip files that cannot be opened by anyone other than the intended recipient. The simplest way to do this is by creating an encrypted zip file.

On Linux systems the popular archive format "tar" does not support encryption natively.
But "zip" format does support encryption.

It can encrypt the contents and can be opened inside the popular Windows zip application Winzip.

Hence the password protected zip files are perfectly portable.

A password protected zip file has all its files encrypted that can be viewed only when the correct password is provided.

Creating password protected zip files is easy on Ubuntu. It can be done from the command line. Here are some command examples of how to create password protected zip file on Ubuntu

1. zip command

The zip command can be used to create password protected zip files easily. Here is a quick example

$ zip -P *secret* file.txt

Note that the P is capital. Can also type "--password" instead of the "-P".

$ zip --password *secret* file.txt

The above approach might be a bit insecure since the password is visible and the command is stored in the terminal history and can be retrieved. Another option is the e option which prompts user to enter the password.

$ zip -e file.txt
Enter password:
Verify password:

The zip utility can be installed on ubuntu through apt-get

$ sudo apt-get install zip unzip

2. zipcloak - Password protect existing zip files

The above methods work well, but there is an easier way. First create a zip file using any of your favorite gui tools and then password protect it using the zipcloak command.

$ zipcloak
Enter password:
Verify password:

This is the quickest method since you don't have to remember any commandline parameters.
Just the name of the command is enough.

GUI Tools

There is a cross platform gui archive manager called Peazip which can be downloaded from

For Ubuntu/Debian compatible .deb installer files check this url:

It is probably the most featureful gui archive manager available for Linux.

With peazip you do not need the commandline/terminal and everything can be done from the gui interface very much like winzip on windows.


If you need to use other compression and archive formats on Linux like ".tar" which do not support encryption, then the only option is to encrypt the archive file as a whole using some encryption program like gpg or ccrypt.

If you have any feedback or questions let us know in the comments below.

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

Leave a Reply

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