I got Mutt working with the default IMAP password management configuration with this line in my config:

set imap_pass = XXXX

Which is obviously not secure. I looked at this

https://wiki.archlinux.org/index.php/Mutt#Passwords_management and http://www.mail-archive.com/mutt-users@mutt.org/msg36375.html

For guidance on how to encrypt the data. Neither solution worked for me though. The Arch linux one seems ideal because I would rather not use a wrapper everytime I start Mutt.

I did gpg --gen-key and set name to John Doe, email to JDoe@example.com and comment to XXX.

I created a file with this data

set EMAIL_PASS = random30digitpassword

I tried encrypting my file with

gpg -e -r "John Doe" ./password

Now if I want to decrypt it should just work without a prompt because I am the one with the keystore but alas if I execute this following command it still prompts for a password

gpg2 -dq password.gpg

Not only did that not work but with this as my Mutt config:

source "gpg2 -dq /home/John/password.gpg | "

set folder      = imaps://lavabit.com/
set imap_user   = JohnDoe@lavabit.com
set imap_pass   = $EMAIL_PASS
set spoolfile   = +INBOX

It complains that that path does not exist (and no password prompt comes up)

So I am pretty much stumped because it isn't working from two angles. Any ideas?

  • Wrong board. Try super user – David Jul 26 '12 at 23:50
  • Sorry about that. Wasnt aware of the super user board. – bashirs Jul 27 '12 at 4:24

I know this is late, but someone else may have this problem too. Try removing the space from between the quote and the pipe. It worked for me.

"gpg2 -dq /home/John/password.gpg |"

According to the mutt manual, user-defined variables should always have the my_ prefix. So, rename EMAIL_PASS with my_email_pass both in the encrypted file and in .muttrc.

Also, what happens when you type gpg -dq /home/John/password.gpg from the command line? Does it decrypt the password file?


Adding to @ooesili 's answer (which debugs the code in the original question and also helped me get started), to fully benefit from gpg to avoid typing passwords all the time in mutt, it may be useful to set up gpg-agent to keep a cache of its passphrase for a more or less long time.

In Linux, this is done by editing .gnupg/gpg-agent.conf and adding a couple of lines like

default-cache-ttl 360000
max-cache-ttl 360000

The numbers represent timeout of the cache in seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.