How to Install and Configure OpenPGP on Ubuntu 18.04

Introduction

PrettyGood Privacy abbreviated as PGP is the most widely used encryption standard when it comes to end-to-end information encryption. It is used to verify whether the sent message is genuine or not.

The GNU Privacy Guard is an implementation of the OpenPGP standard which features a key management system, along with access modules of all kinds of public key directories. Messages are encrypted using asymmetric key pairs individually generated by GnuPG users. The public keys are exchanged with other users either via key servers on the internet or any other safe way to ensure identity spoofing is not done so by corrupting the public key.

Digital signatures may also be added to a message to enforce its integrity. This is achieved by appending the signature using the private key generated which will be verified by the recipient’s copy of the sender’s public key.

Here, we show you the steps to take for installing and configuring GnuPG on Ubuntu 18.04.

Steps

Update System Packages

$ sudo apt update && sudo apt upgrade

Install GnuPG Package

$ sudo apt install gnupg

Generate your Key Pair

Once the package is installed, you can now go ahead and generate your key pair. Type in the following command:

$ sudo gpg --gen-key

Follow the subsequent prompts by entering your information as seen in the response below:

gpg: WARNING: unsafe ownership on homedir '/home/linuxuser/.gnupg'gpg (GnuPG) 2.2.4; Copyright (C) 2017 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Note: Use "gpg --full-generate-key"for a full featured key generation dialog.
GnuPG needs to construct a user ID to identify your key.
Real name: Linux User
Email address: linuxuser@email.com
You selected this USER-ID:
"Linux User <linuxuser@email.com>"
Change (N)ame, (E)mail, or (O)kay/(Q)uit? O

You will then be prompted to enter your passphrase and confirm it.

Special Note: Please ensure that the information you are entering is valid

The system will then use a process known as entropy to generate the key pair. This is the amount of unpredictability in the system.

Create a Revocation certificate

When your private key has been compromised, you may need to revoke it and warn other users against receiving messages coming signed with the compromised private key. This is because an attacker may be impersonating you. To do this, enter the following command – Ensure you replace the email with the email entered during generation of your key pair.

$ gpg --output revoke.asc --gen-revoke  linuxuser@email.com

You will receive the following output.

         Revocation certificate created.
     Please move it to a medium which you can hide away; if Mallory gets access to this certificate he can use it to make your key unusable.
     It is smart to print this certificate and store it away, just incaseyour media become unreadable.  But have some caution:  The print system of your machine might store the data and make it available to others!

Ensure you follow the instructions on the output above. You may also revoke permissions on the certificate document just to ensure no one compromises it.

$ sudo chmod 0600 revoke.asc --gen-revoke  linuxuser@email.com

Conclusion

You have learned how to install the GnuPG package, create a key pair and a revocation certificate.

The next recommended step is to look at how to upload the key pair to a key server in order to save other GnuPG public keys and to encrypt messages with the public keys and sign them.

Check out these top 3 Linux hosting services

HostArmada
$1.79 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
IONOS
$1.00 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3
Ultahost
$2.90 /mo
Starting price
Visit Ultahost
Rating based on expert review
  • User Friendly
    4.3
  • Support
    4.8
  • Features
    4.5
  • Reliability
    4.0
  • Pricing
    4.8

How to Create a Non-root User on Your Ubuntu 18.04 VPS or Dedicated Server

This guide shows you how to create a user on your Ubuntu 18.04 virtual server.
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Install a Self-Signed SSL Certificate on Your Ubuntu 18.04 VPS or Dedicated Server

This how-to article will teach you how to create a self-signed SSL certificate o
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Set Up Cron Jobs on Your Ubuntu 18.04 Dedicated Server or VPS

This guide shows webmasters and administrators how to set up cron jobs on your U
3 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Install WordPress on Your Ubuntu 22.04 VPS or Dedicated Server

This tutorial will show you how to install WordPress on your Ubuntu 22.04 virtua
3 min read
Idan Cohen
Idan Cohen
Marketing Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top