I’ve been using mutt for reading my emails for some time now. It is simple, fast, configurable, and yeah, did I mentioned it is a command line email client? Anyhow, only thing I have been fighting with was on how to securely store password without putting it to .muttrc
file (which is plain text file).
When I used to use GNOME I have used Seahorse while on the command line I’ve used secret-tool
for fetching the password. Now that I’ve switched to KDE fully, I decided to remove GNOME components from my system one by one. It was Seahorse’s turn to “leave the house” as it was only used for the purpose of fetching passwords on the command line.
Without further blabbering here are the things you need to do.
First of, you should start by saving the password to your KDE Wallet. To do that, open up “Wallet Manager”. You should be prompted with window like:
As you can see, default wallet is called “kdewallet”. If it is configured to use the same password as your Linux system user it will automatically unlock at login (in case you’ve set it up with blowfish encrypted file).
To insert a new password, navigate to the appropriate folder (in my case that’s Passwords) and add entry with Insert button on your keyboard or simply right click the Passwords category and click Insert. You should be prompted with window like:
In this example I’ll name my entry “testentry” and hit “OK”.
Now, expand that Passwords category and click on your “testentry” item on the list. You should now see something like:
Click on the “Show contents” option, then in white, blank box type in your password/secret and hit that Save button in the bottom right hand corner.
Finally, to fetch password from the command line you can now use following command:
kwallet-query -f Passwords -r testentry kdewallet
You could see some warning messages but at the bottom there should be your password entry:
To use that within your .muttrc
simply put it in form such as:
set imap_pass=`kwallet-query -f Passwords -r testentry kdewallet`
set smtp_pass=`kwallet-query -f Passwords -r testentry kdewallet`