How to Encrypt Files with GPG

Title image for encrypt files with GPG

No matter if you're a developer, system administrator, or simply a fan of SSH and command line, InMotion's Cloud Hosting plans provide a fast, scalable environment that is budget-friendly.

Encrypting files with GNU Privacy Guard (GPG) is one of the best known ways to protect your most critical data. If you have already followed our guide on creating a GPG key, you are now ready to encrypt files using your key, rendering these files readable only to people you have designated.

Most Often Used to Secure Email

GPG is commonly used to send encrypted email back and forth between two or more parties. If you have any kind of secret or proprietary information, using email encryption is the best way to make sure the content is readable only by the people you trust.

But when not used for email, GPG can be used to encrypt individual files or archived files. If you don’t want to set up encryption in your email client, or if you don’t have the privilege, you can still encrypt individual files and send them as attachments.

How to Encrypt Files with GPG

For more information be sure to check out the GPG documentation.

There are two important parts of the encryption process. First, you have to associate a key with the file so that the GPG program knows which key to use. But to make it easier, and faster, you can sign and encrypt a file with one command—if you use the correct options.

gpg --encrypt -r <[email protected]> <file.txt>

What do these options mean?

--encrypt
As it indicates, “encrypt” will create an encrypted copy of the file.
-r
“Recipient” indicates that you will provide an email address (associated with a key) to use for encrypting this file.
CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+