How to Password-Encrypt Compressed Directories on Linux.

Password compression of files is a very important file operation that is usually done for very legitimate reasons like file size reduction (especially when considering memory space) and encryption for security reasons. Since security is very important to computer use, it would be very advisable to password-protect folders (or directories) and files containing personal information – especially in cases where you share a computer system with other people. Also now coupled with the fact that there is the “privacy security” buzz going on all over the Internet.

In previous articles I’ve sown how we can compress files and directories using some common Linux compressing algorithms graphically and on the command line. So in this post I would be showing how you can add password to directories and files when compressing them.

There are many compressing algorithm that you would see, most of them do support password protection – including “zip” and “rar”.

Using “zip”:

STEP1 – Create a folder to contain all the files you want encrypt (for demonstration I have created a folder called “encryption” containing two video – movie – files). If you already have a folder with the contents inside, skip this step and go to the next.

STEP2 – Right-click on the folder, scroll down to select the “compress…” option.




STEP3 – Select the “Filename” you want the encrypted file should be called. Its okay to retain the name of the original unencrypted file.

STEP4 – Select the encryption algorithm, we are using “.zip” here.

STEP5 – Select the “Location” to save the encrypted file – the current location of unencrypted file is the default.

STEP6 – Then click on the “Other Options” tab to reveal the “password” input.

STEP7 – Enter the password to encrypt the file. I would advise yo to click the shield icon in the far right corner of the password input field to reveal the password as you type it so that you don’t make mistake in typing the wrong password since you’d be typing it once before encrypting.



STEP8 – Then click the “Create” button after checking all the input field are what you desire. Then encryption begins…




…then its completed with a new copy of an encrypted folder.




Try to open the encrypted folder. You should get something like this.




Using “rar”:

STEP 1 – 3: As above.

STEP 4: Select the encryption algorithm, we are using “.rar” here.

STEP 5 -7: As above.

STEP 8: after entering the password click the “Encrypt the file list too” selection. Then click the “Create” button.




Then encryption begins…




…then its completed with a new copy of an encrypted folder.




Try to open the encrypted folder. You should get something like this.




The major difference in encrypting using “zip” and “rar” is that in .zip you can still access (open) the folder, its only when you want to accessed containing files that you’re asked fr a password. This means that people can see the content of the folder (pictures, audio, documents etc) just that they can open it. But in the case of .rar everything is encrypted, so on trying to access t he folder you’re asked for a password. This is good when you don’t want people to even have a clue of or see the folder’s content.

You can also add password to previously compressed directories (and files) by re-compressing them with password. That is, create a new folder and move the previously compressed files into it and then compress the new containing folder with a password.

Happy Linux’NG!


I agree to have my personal information transfered to MailChimp ( more information )

Join over 10,000 visitors to receive Open Source tips, trick, news, tutorials, programming and more.

We hate spam. Your email address will not be sold or shared with anyone else.

MUST READ  CDMA: Hydrating an Internet-drought country

Tell us what you think

This site uses Akismet to reduce spam. Learn how your comment data is processed.