Tags Archives: unzip

How to Password Protect a Folder into a Compressed Password Protected Archive File

There are numerous ways to encrypt a file or a directory under Linux.


Some of these methods involve deploying specific encryption utilities or public/private key systems such as gpg.


I wanted to deploy a simple method that relies on mainstream tools which are usually present on most if not all Linux systems.


The method described below uses tar and zip/unzip.



Create a Tar Archive



First, tar the folder into a .tar archive:




tar -cvf folder.tar /folder



Create a Password Protected Compressed File using zip



then zip the .tar file:


zip -re folder.tar.zip folder.tar


it will prompt you to enter a password of your choosing and then verify it



To Unzip



to unzip you have to use


unzip <zip.file>


This will prompt you to enter the password


unzip folder.tar.zip






tar -xvf folder.tar


this then recreates the directory structure and the contents


Continue Reading