Home Blog How to Password-Protect Files and Folders on Linux

How to Password-Protect Files and Folders on Linux

by universalverge

Whether or not you need to share a file on-line, retailer it within the cloud, carry it on a thumb drive, or add it to your archive, password-protecting it’s the greatest strategy to safe its content material and stop unauthorized entry.

The identical holds true for folders too. Subsequently, it is essential to encrypt them as nicely. On Linux, you might have a number of methods to password-protect information and folders. Most of those strategies use encryption, which affords further safety than others.

Here is a have a look at all of the totally different strategies you should use to password-protect information and folders on Linux.

Find out how to Password-Defend Recordsdata on Linux

Linux has a number of utilities that can assist you password-protect/encrypt information in your laptop. Listed beneath are the strategies you should use to do that.

Methodology 1: Encrypt a File Utilizing GnuPG

GnuPG is a free Linux program that helps a number of encryption requirements for file encryption. It comes pre-installed on most Linux distros and is fairly simple to make use of.

GnuPG is accessible through the CLI. Here is how you should use it to encrypt a file :

  1. Open the terminal.
  2. Use the cd command and ls command to navigate to the listing containing the file you need to password-protect.
  3. As soon as contained in the listing, run the next command to encrypt your file:
    gpg -c filename
  4. Lastly, when prompted for a passphrase, sort in one which’s robust and simple to recollect.

GnuPG will now create an encrypted file (with .gpg extension) in your present working listing. To entry it, you will have to decrypt it. For this, run the next command, and when prompted for a password, enter the one you used to encrypt the file and hit Enter:

Also Read  Bigg Boss 15: Salman Khan questions Jay Bhanushali`s stand on prize money task

gpg filename.gpg

GnuPG will return a decrypted model of the file in your present working listing.

If you would like to make use of every other encryption algorithm, first, examine the supported ones by working:


After which, specify the specified algorithm within the command like this:

gpg -c 

Methodology 2: Encrypt a File Utilizing Zip

Zip is one other CLI utility that allows you to password-protect information on Linux. It comes pre-installed on all main Linux distros and is good for archiving or zipping a number of information into one encrypted archive.

Observe these steps to make use of Zip for password-protecting a file:

  1. Open the terminal and use the cd and ls instructions to enter the listing with the information to encrypt.
  2. Enter the command within the following format to create a password-protected zip file:
    zip --password preferred_password archive_file.zip filename1 filename2

    Right here, change preferred_password with the password you need to use to encrypt the archive and archive_file.zip with the file title you need to give to the resultant archive.

Now, if you need to entry these information, unzip the archive and enter your password. Or, to do it through the terminal, run:

unzip archive_file.zip

Zip will now ask you for a password. Enter the password you set on the time of encryption and hit Enter to decrypt the file.

Methodology 3: Encrypt a File Utilizing mcrypt

mcrypt is a crypt alternative that makes encrypting information on Linux simple. It helps numerous encryption requirements and you’ve got the choice to specify the encryption algorithm primarily based in your desire.

Listed below are the steps to encrypt a file utilizing mcrypt:

  1. Open the terminal, and utilizing cd and ls, go into the listing that comprises the file you need to encrypt.
  2. Enter the command beneath to listing out all of the supported encryption algorithms:
    mcrypt --listing

  3. Lastly, encrypt your file utilizing:
    mcrypt -a algorithm_name filename

    When requested for a passphrase, enter it twice and hit Enter.

mcrypt will now encrypt your file and put it aside with the “.nc” extension. In case you want to open this file, you will have to decrypt it. To do that, run:

mcrypt -d filename.nc

After which, enter the decryption passphrase.

Find out how to Password-Defend Folders on Linux

Much like the way you password-protected information on Linux, password-protecting folders can be simple. Under is an inventory of all of the strategies you should use and the steps to make use of them.

Methodology 1: Encrypt a Folder Utilizing GNOME EncFS Supervisor

GNOME EncFS Supervisor is a mounting utility that allows you to encrypt folders on Linux with ease. It is supported by most Linux distros and has a neat GUI, which makes it simple to make use of.

Listed below are the steps to make use of GNOME EncFS Supervisor for encrypting a folder on Linux:

  1. Open the purposes menu, seek for GNOME EncFs and launch it.
  2. Faucet on the plus (+) icon within the toolbar. Within the dialog field that follows, choose the second radio button underneath Listing or drive to encrypt or import and choose a folder. Ensure to create a brand new (empty) folder right here. (You may want to maneuver over the contents of your authentic folder to this folder later.)

  3. Choose an applicable choice for the mount listing, i.e., the situation the place you need the encrypted folder to be mounted.

  4. Below Password, enter the password you need to use to encrypt the folder twice.
  5. Hit Create to create an encrypted folder.

GNOME EncFS Supervisor will now create an encrypted folder (additionally referred to as stash) and mount it to your chosen vacation spot listing. Double-click on this mounted drive to entry the contents of the folder inside. To unmount it, examine off the checkbox beside it. Or right-click on the stash and choose Unmount.

Now, if you need to mount it once more, simply tick the checkbox. GNOME EncFS Supervisor will ask you in your password. Enter the password, and you must now have the ability to entry all its contents.

Methodology 2: Encrypt a Folder Utilizing VeraCrypt

VeraCrypt is a free and open-source disk encryption software. It is obtainable on all main working techniques, and you should use it to create an encrypted listing on Linux the place you’ll be able to retailer information and folders securely.

First, obtain VeraCrypt in your laptop from the hyperlink beneath and set up it.

Obtain: VeraCrypt

Subsequent, launch it from the purposes menu and observe these directions:

  1. Choose a drive slot and click on on Create Quantity.

  2. Choose Create an encrypted file container and hit Subsequent.

  3. Select quantity sort as Normal VeraCrypt.

  4. Click on on Choose File and create a file to retailer the encrypted disk.
  5. Choose an encryption algorithm and hash algorithm as per your desire and hit Subsequent.

  6. Give a quantity measurement for this drive.
  7. Enter a password to lock this drive twice and hit Subsequent.
  8. Select quantity format sort, i.e., file system from the dropdown.

  9. Lastly, hit Format to create a VeraCrypt quantity.

Now, you have to mount this encrypted quantity. To do that, return to the VeraCrypt important window and click on on Choose File underneath Quantity. Select the file and click on on Mount. When prompted for a password, enter the password you set on the time of quantity creation.

VeraCrypt will now mount your encrypted drive, and subsequently, you’ll be able to add all of your private knowledge (information or folders) to this drive. Once you’re completed working with these information and want to lock and conceal them away, unmount the drive.

Safe Private Knowledge on Linux Successfully

Relying in your desire, you’ll be able to decide any technique and gear listed above to password-protect your information and folders on Linux and stop unauthorized entry. In case you share your laptop with somebody, this is usually a actually efficient manner to make sure nobody apart from you’ll be able to entry your private knowledge.

Source link

Related Articles