Unlock ‘pass’

password

In my search for a simplistic password manager, I found 'pass' and made it my choice. One unexpected difficulty, that I encountered, is that web searches about its features are difficult to phrase in a way that produce desired results – simply due to its name. I consequently wasn't able to find an answer to the following two questions:

  1. Can I unlock pass for my entire session? I wrote a couple of scripts that ask 'pass' for a particular password, instead of saving this password in a plain text (which I am not willing to do). As an example of this, I use emacs and mu4e in connection with offlineimap in order to obtain my emails and it can be rather annoying to retype my password every time I want to update my inbox. It would be nice if there was a way to unlock my password manager for a set amount of time or an entire session.
  2. Provided that my first question has a positive answer: How can I use pass to provide the passphrases to my ssh keys? I use ssh on a daily basis on a few different machines and defined alias for them. Obviously I could make the password, in plain text, part of this alias, but this isn't acceptable for me. I could also write a small script that first asks pass for the passphrase and then establishes my ssh connection. I wonder if there is a 'simpler' solution.

Best Answer

  1. pass uses gpg to encrypt your passwords. This means you can use gpg-agent to cache your passphrase, thereby allowing the gpg tools and therefore pass to decrypt its files without asking for your passphrase again. If you're using GnuPG >= 2.1.0, gpg-agent will be started automatically. If not, there are (unfortunately) numerous ways to have gpg-agent start along with your login or X session.

The Arch Wiki contains a lot of information about how to configure and use gpg-agent, but the most important one is probably the following entry in ~/.gnupg/gpg-agent.conf:

default-cache-ttl 3600

This allows adjusting the time (in seconds) that gpg-agent will remember your passphrase. The default is 60.

2. You can also use gpg-agent to cache ssh keys. Unfortunately I've never managed to set this up reliably, so I can't give you any hints here.

Also, unrelated to your questions, but auth-password-store integrates pass with Emacs' auth-source mechanism.

Related Question