Richard,

I use GnuPG to encrypt/decrypt my passwords for mutt.  For each imap account, I
create a little text file that contains the appropriate password, and encrypt
that file using my public key.  Then I use command substitution to set imap_pass
in muttrc.  For example,

  set my_imap_un=hesla
  set my_imap_pw=`gpg2 -d --batch  ~/.mutt/.imap_pw.gpg`

  account-hook imap://my.imap.server:143 set imap_user=$my_imap_un
  account-hook imap://my.imap.server:143 set imap_pass=$my_imap_pw

(You do need the "--batch", to prevent the passphrase prompt.)

If the password contains a special character, just backslash escape it, then
enclose the whole password in single quotes.  For example, if your password
were

  45B;abcd

then the text file (before encryption) should contain the single line

  '45B\;abcd'

(including the single quotes).  This works fine with my setup.

BTW, I use gpg-agent to avoid having to key in my passphrase multiple times per
day.

Regards,

-- 
Todd Hesla



On Wed, May 18, 2011 at 07:24:49PM +0200, Ђорђе Тодоровић wrote:

> Date: Wed, 18 May 2011 19:24:49 +0200
> To: Richard <r...@linux-m68k.org>, mutt-users@mutt.org
> From: Ђорђе Тодоровић <postmanmi...@gmail.com>
> Subject: Re: imap_pass password management
> 
> On Wed, 18 May 2011, Ђорђе Тодоровић wrote:
> 
> >On Wed, 18 May 2011, Richard wrote:
> >
> >>On Wed, May 18, 2011 at 01:43:05PM +0200, Ђорђе Тодоровић wrote:
> >>
> >>>Is it possible to have my imap_pass set dynamicaly to be an output of some 
> >>>CLI password
> >>>management program (like pwsafe)? Exaple:
> >>>
> >>>imap_pass = "echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) |"
> >>
> >>does that work?
> >>
> >>imap_pass = `echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) `
> >>
> >
> >That works fine, thank you. Also I found this link:
> >  http://www.mail-archive.com/mutt-users@mutt.org/msg36375.html
> >
> 
> I just noticed that this example doesn't work with passwords that contain
> certain special characters (#"'). Anyone know how to sanitize input so mutt 
> can
> read passwords from stdin?
> 
> If a password contains "#", mutt reads an empty string.
> If a password contains quotes, imap_pass gets a password + entire muttrc file
> below a "set imap_pass..." field.
> 
> -- 
>  . O . | Djordje Todorovic [aceofknaves at G_M_A_I_L .com] | O . O
>  . . O | GPG-Key: 2048R/1E133339      (http://pgp.mit.edu) | . O O
>  O O O | BFF2 1C7F A70D ECCD FA8F C946 DB32 B498 1E13 3339 | . O .

Reply via email to