mutt can't get password from an encrypted .gpg file

1

I am trying to get the imap/smtp password for my email accounts in mutt by parsing an earlier decrypted .gpg file via awk, and assigning the result to a variable used in .muttrc

# Process the password files first
2 # --------------------------------
3 set my_tmpsecret=`gpg -o ~/.secret/.tmp -d ~/.secret/.passwd.gpg`
4 set my_gpass=`awk '/GMail/ {print $2}' ~/.secret/.tmp`
5 set my_del=`rm -f ~/.secret/.tmp`

10 set imap_pass=$my_gpass

During the startup of mutt the .tmp file contains the following string

Gmail    PASSWORD

This is then parsed by awk, and the result assigned to the $my_gpass variable

When trying to start mutt, it still asks me to manually enter the password for imap/smtp. Does anyone have an idea what i'm doing wrong?

Michael

Posted 2012-08-27T11:37:41.560

Reputation: 13

Answers

2

Your file has Gmail, but your script is looking for GMail.


Also, the muttrc could be written better:

set my_pass=`gpg -d ~/.secret/passwd.gpg | awk '$1 == "Gmail" {print $2}'`
set imap_pass=$my_pass
set smtp_pass=$my_pass

user1686

Posted 2012-08-27T11:37:41.560

Reputation: 283 655

The pipe is also a nice improvement. Thx – Michael – 2012-08-27T12:11:29.833