How to encrypt and decrypt GPG mails in the terminal

Updated . Posted . Visible to the public.

Encrypting

gpg -e -a -r <receiver@email.address> [-r <receiver2@email.address>]
<type message>
<ctrl d>

Now copy the PGP message to your mail client and send that mail.

  • You need one -r flag per receiver address
  • With a single receiver, you can also write gpg -ear reci@pie.nt

Decrypting

gpg -d
<paste encrypted message>
<ctrl d>

Adding public keys

gpg --keyserver keyserver.ubuntu.com --search-keys <user@domain.com>
<number of the search result that should be imported>

Also see Using GPG/PGP with Ubuntu and Thunderbird.

Dominik Schöler
Last edit
Simon Hofmann
Keywords
command, line, pgp
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra orga (2020-07-10 11:28)