How to create password protected zip archive on ubuntu

Command Line

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

$ zip -P *secret* compressed.zip file.txt

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

$ zip --password *secret* compressed.zip 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 compressed.zip file.txt
Enter password: 
Verify password:

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

$ sudo apt-get install zip unzip

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 confidential.zip 
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

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

http://peazip.sourceforge.net/

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.







Last Updated On : 5th March 2013

Subscribe to get updates delivered to your inbox

Leave a comment