Blog de tfe, Perl, Web et Libre...?

Simple tutorial - Mutt with GPG Encryption

PubliƩ le 23/02/2016 dans Linux

Simple tutorial to use GPG with your favorite email client: mutt!

1 - Generating your GPG key

Open a terminal and run the following command:

$ gpg --gen-key

2- Configure which key server use:

To choose the server you want to use to send your key, edit the file ~/.gnupg/gpg.conf and add the following line:


3- Send the public key to the server

Beforing sending the key, check if all the information given is correct:

$ gpg --list-keys

Note that the list-keys parameter allows you to get the KEY_ID, you must provide in the mutt configuration later.

The send the key:

$ gpg --send-keys

4- Configuring mutt

Let's find the file gpg.rc on your system and copy it to your home directory:

$ locate gpg.rc
$ cp /gpg_file_location  ~/.gpg.rc

Then  edit the file ~/.muttrc . To enable the gpg encryption, add the following lines:

	source ~/.gpg.rc
	set pgp_use_gpg_agent = yes
	set pgp_sign_as = YOUR_KEY_ID
	set pgp_timeout = 3600
	set crypt_autosign = yes
	set crypt_replyencrypt = yes
	send-hook "~f your_email_address" set pgp_sign_as=YOUR_KEY_ID
	bind compose p pgp-menu
	macro compose Y pfy "used to mail without the GPG encryption"

And that's it! You can now use mutt, and it will auto-encrypt the emails when sending from your_email_address.