How to encrypt documents on Linux

3 Mins read

Are you working with office documents a lot on your Linux PC? Looking to keep everything private and secure? Consider using encryption. It can keep your documents safe from prying eyes. In this guide, we’ll go over how to encrypt documents on Linux using Libre Office and GPG. Let’s get started!

Method 1 – Libre Office

Libre Office, the default office suite for most Linux distributions has support for encrypting document files. So, if you have confidential documents, such as tax information, sensitive work files, and stuff like that, you can rely on Libre Office to keep your data safe.

Install the Libre Office suite on Linux

Most Linux distributions already have Libre Office set up and installed. However, some don’t. If your Linux operating system does not have the Libre Office suite, head over to the official Libre Office website, click the download button and go from there. Alternatively, search “Libre Office” in Gnome Software, the Snap Store, or KDE Discover and install it that way.

Encrypt documents with Libre Office Writer

To start, open up a terminal window and generate a new GPG key with the following command.

gpg --full-generate-key

Follow the on-screen prompts to set up the GPG key on your Linux PC. If you plan to encrypt on multiple PCs, you may need to do this step on those machines too. Then, when the key is done decrypting, launch Libre Office Writer on the Linux desktop and write out your document the way you typically would.

Note: though this tutorial primarily focuses on Libre Office Writer, all Libre Office software applications support encryption, and the instructions below to enable it are similar.

Once your Libre Office Writer document is all filled and written out, press Ctrl + Shift + S to open up the save dialog. Or click “File,” and then “Save As.”

Inside of the Libre Office Writer saving dialog, write in the name of your document, and make sure it is in the ODT file format. Then, look for the “Encrypt with GPG key” box and check it to enable the encryption feature.

After clicking the “Encrypt with GPG key” box, a dialog box will appear showing existing GPG keys on your Linux PC. Go through and select the key you made earlier to encrypt it against your key.

Encrypting existing files

Need to encrypt a document you already have saved with Libre Office? Open up the file in Libre Office, and press Ctrl + Shift + S (or File > Save As) to bring up the save dialog box.

Save the new document file with your desired file name, and check the “Encrypt with GPG key” box, and select your GPG key in the pop-up window to encrypt the file.

Lock with password

Libre Office has a useful encryption feature, but if you don’t want to deal with GPG keys, there’s another way to keep your documents private: with a password.

To lock your Libre Office document with a password, open up an existing document, or, create a new one and paste in the text you’d like to lock up. Then, press Ctrl + Shift + S on the keyboard to bring up the save dialog.

In the save dialog, write out the name of the document, and set the file format to “ODT.” Check the “Save with password” box. Enter your password in the next window to lock it up.

Method 2 – GPG

Those not using Libre Office will not be able to take advantage of its built-in encryption features. Not to worry though, it is possible to encrypt all kinds of documents right from the Linux command-line using the GPG tool. Here’s how to do it.

To start the encryption process, open up a terminal window. You can open up a terminal window on Linux by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, with the terminal window open, use the CD command to move to where your unencrypted document is.

cd ~/location/of/unencrypted/document/

After moving to the location of the unencrypted document, use the gpg -c command to start the file encryption.

gpg -c your-document-here

Upon running the gpg command above, you’ll be asked to set a password for the file. Write out a strong, memorable password in the prompt to encrypt the file.


Decrypting your document file with GPG is as easy as encrypting it. To do it, move the terminal window to the location of the encrypted document using CD.

cd ~/location/of/encrypted/document/

Then, use the gpg command to unencrypt your document file.

gpg your-encrypted-document-here

After writing the command above into a terminal window, you’ll be asked to enter your password. Do so, and your document will be unencrypted and ready to use!

Love Tech? Join Us For Latest Updates In Tech World!

We respect your privacy! We'll never spam you!

Leave a Reply

Your email address will not be published. Required fields are marked *