Passwords on OS X via security

Paul W. Rankin hello at paulwrankin.com
Wed Nov 12 11:33:37 GMT 2014


I've just started using offlineimap and it is the greatest. It's gold
Jerry, gold!

I'd love to use an "elegant one-liner" (i.e. no pythonfile) to retrive
my account password, which is stored in a local OS X keychain. The
following content of my ~/.offlineimaprc is not successful:

--8<---------------cut here---------------start------------->8---
[Repository Remote]
type = IMAP
remotehost = mail.example.com
remoteuser = user at example.com
remotepasseval = `security find-generic-password -a user at example.com -s mail.example.com -w`
--8<---------------cut here---------------end--------------->8---

nor any of these...

--8<---------------cut here---------------start------------->8---
remotepasseval = "`security find-generic-password -a user at example.com -s mail.example.com -w`"
remotepasseval = "`security find-generic-password -a user at example.com -s mail.example.com -w` | tr -d '\n'"
remotepass = `security find-generic-password -a user at example.com -s mail.example.com -w`
remotepass = `security find-generic-password -a user at example.com -s mail.example.com -w | tr -d '\n'`
--8<---------------cut here---------------end--------------->8---

etc. etc.

It's not the password. I've tested by copying the output of the
`security` command and pasting into .offlineimaprc and everything Just
Works (but obviously with real values).

So how to I succesfully call the `security` command from .offlineimaprc?

Thanks for your time :)

-- 
Paul W. Rankin
http://www.paulwrankin.com




More information about the OfflineIMAP-project mailing list