Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-25-2017, 04:03 AM   #1
LQ Newbie
Registered: Feb 2017
Posts: 19

Rep: Reputation: Disabled
mutt and password file decrypt

I'm using mutt, and read up on GPG encryption to store my passwords securely in a separate password file, rather than plain text in the .muttrc file.

Here's what I followed to create my key (public/secret)

And here's what I followed to secure mutt passwords

When I run mutt, it fails to decrypt the gpg key. Here is the error that is displayed when mutt exits (changed ID to random number):
gpg: encrypted with RSA key, ID 238947239874249
gpg: decryption failed: No secret key

I have verified both GPG public secret keys exist with the following:
gpg2 --list-public-keys
gpg2 --list-secret-keys

I created GPG key using gpg2 and terminal.
FWIW, I noticed seahorse doesn't see the key, but gpg2 terminal does.

New findings
Looking further into this... the problem is definitely privilege related.
When I decrypted the password file using root, it decrypted ok, e.g. sudo gpg2 -d .muttpasswd.gpg

Does this mean, since I use a GPG key, I will have to run mutt using root privileges?
FYI when I prefix with sudo for gpg2 -d' command in .muttrc, it works, but I have to enter my password, then my passphrase. An un-desirable workaround!

More findings
I setup Evolution to use my gpg key (created with gpg2), and same error!
BUT, when I created a new GPG key with seahorse, and used this in Evolution it worked!

So the problem is 1) not mutt config related, 2) not privilege related, but something to do with where gpg2 and seahorse store the keys and therefore access by applications.

Note FWIW, gpg and gpg2 CANNOT see the key I created with seahorse, and vice-versa.

Last edited by FedoraPete; 02-26-2017 at 05:36 PM. Reason: More findings
Old 02-26-2017, 03:13 AM   #2
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
SELinux is enabled?
Old 02-26-2017, 05:38 PM   #3
LQ Newbie
Registered: Feb 2017
Posts: 19

Original Poster
Rep: Reputation: Disabled
Originally Posted by c0wb0y View Post
SELinux is enabled?
Yes SELinux is enabled. I disabled and rebooted and still the problem exists.

But I did discover the problem is related to keys created by gpg2 or seahorse - included my findings in the original post.
Old 02-26-2017, 05:50 PM   #4
Senior Member
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,075

Rep: Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725
Can you decrypt the file outside of mutt and not with sudo (ie, as your standard user)? If not, who owns your gpg-encrypted files? you or root?

Maybe the decryption is failing because you don't have correct access to the file. Maybe you should create your .muttpasswd.gpg file fresh.
1 members found this post helpful.
Old 02-26-2017, 06:40 PM   #5
LQ Newbie
Registered: Feb 2017
Posts: 19

Original Poster
Rep: Reputation: Disabled
Thanks notKlaatu, that's the issue!

I was creating the GPG key using sudo. Hence why mutt, evolution, seahorse running under my account couldn't access the GPG key. Ugh, what was I thinking!!!

Created a new key with GPG2 without sudo and this time and everything works! Phew!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
encrypt and decrypt password in .profile manish72 Linux - Newbie 3 07-28-2011 08:25 PM
Decrypt password bsdfan *BSD 7 07-02-2010 12:49 AM
Decrypt Password in linux abrenar Linux - Software 8 03-03-2009 01:59 PM
How can I decrypt a BACKUP FILE? I have the password. Balarabay1 Linux - Software 4 10-02-2006 12:42 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration