How to Encrypt Sensitive Files Using GnuPG on Linux

Nowadays, news revolving around hacking, ransomware, and data compromise is very common. Therefore, it is important to be very vigilant in protecting personal files and sensitive data.

On Linux, you have GnuPG, a simple yet comprehensive encryption tool that you can use to secure important data on your system.

4

What Is GnuPG?

GnuPG or simply GPG is an encryption technique that has gained wide popularity because of its ease of use and top security algorithms. It is an open-source implementation of the Open PGP Standard.

Linux provides you with the GnuPG command-line utility to help users get familiar with GPG encryption and security keys. Apart from encrypting and securing files, GPG is also used in securing software and package downloads.

gnupg keys in action on linux

GitHub also gives you the option to use GPG as an alternative method to the traditional SSH keys.

Installing GnuPG on Linux

GPG is installed by default onmost Debian-based distrossuch as Ubuntu and Lubuntu, but in case you do not have it installed, here’s how to install GnuPG on your system:

On Debian-based distros:

salaries file in text format

On RHEL, Fedora, and similar distros:

On Arch-based distros, switch to the root user usingsuand run the following command:

Send encrypted email on Linux with GnuPG

Encrypting a File Using GnuPG on Linux

You can use GPG to encrypt any file format. Let’s assume that you have an important file containing salaries for your organization; obviously, you do not want other people looking at this sensitive data.

The file data looks as follows:

windows recovery environment on laptop screen.

To encrypt the file, simply run the command using the formatgpg -c filename. For example, let’s encryptsalaries.txt, which is a text file located in the present working directory. Feel free to use any file to follow along.

The system will prompt you to provide a passphrase. Enter a secure passphrase and proceed.

GPG will create another file with the.gpgfile extension appended to the original file name. If you runthe ls commandin your Documents directory or wherever your file is, you’ll notice that GPG has created an extra file.

Runthe cat commandto view the content of the newly encrypted GPG, and you’ll get some gibberish text, meaning your data is now encrypted.

To view the contents of the file, you’ll first need to decrypt it with GPG using the command:

You can now safelydelete the unencrypted fileusing the rm command.

Secure Your Messages and Files Using GPG on Linux

GnuPG is a great tool for both encrypting and password-protecting your data on Linux. If you have sensitive data on your PC, you should consider encrypting it.

Apart from securing sensitive files with GPG, you can take your security awareness a step further and encrypt communication messages transmitted over the internet using GPG key pairs.

Want to send and receive secure emails on Linux? Here’s how to use GnuPG to create and manage encrypted email messages.

It’s not super flashy, but it can help to keep your computer up and running.

You don’t need to fork out for expensive hardware to run an AI on your PC.

Tor spoiled me forever.

Don’t let aging hardware force you into buying expensive upgrades.

Turn these settings on, and your iPhone will be so much better than before.

Technology Explained

PC & Mobile