Password-Protect Files on Linux

#Introduction

In this tutorial, How to Password-Protect Files on Linux. To prevent unauthorized access to files and folders and secure them with a strong password.

How to Password-Protect Files on Linux

Encrypt a File with GnuPG

I use gpg command to encrypt a file. GnuPG is a free Linux program that supports multiple encryptions for file encryption.

1. Open the terminal

2. Run the following command line to encrypt your file.

gpg -c your_file

GnuPG will create an encrypted file with .gpg extension in your current working folder.

The result is the picture below:

Password-Protect Files on Linux

To access it, you’ll need to decrypt it. For this, run the following command

gpg your_file.gpg

The result is the picture below:

How to Password-Protect Files on Linux

other encryption algorithms, first, check the supported ones by running:

gpg version

For example, you specify the desired algorithm as a command below

gpg -c --cipher-algo algorithm_name your_file

using the zip command to Encrypt a File

the zip command is another CLI utility that password-protect files on Linux. it is pre-installed on all Linux distros.

zip --password your_password archive_file.zip file1 file2

you replace your_passowrd with the password you want to use to encrypt the archive.

To unzip the archive and enter your password. you can run the command below:

unzip archive_file.zip

Encrypt a File Using mcrypt

list out all the supported encryption algorithms

mcrypt --list

encrypt filename

mcrypt -a algorithm_name filename

If you wish to open this file, you’ll need to decrypt it as the command below:

mcrypt -d filename.nc

Conclusion

You have Password-Protect Files on Linux. I hope will this your helpful. Thank you for reading the DevopsRoles page!

,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published.

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