1

When I am running in the GUI, if I run the pass command to read a password such as pass -c Email/FooBar, a password prompt will appear for my passphrase. If I type my password, my password will be copied into the clipboard.

If I subsequently run the pass command to read a different password without logging out and logging back in again, I do not need to type my password again.

However, if I try the same thing in the virtual terminal Control-Alt-F1, I need to type my password each time.

How can I make it so that I can type the password exactly once per login session in the virtual terminal?

4
  • Try getting the $DBUS_SESSION_BUS_ADDRESS variable from your GUI session and setting it to the same value in your Virtual terminal. There's most likely a daemon running that stores the passwords and a $DBUS_SESSION_BUS_ADDRESS is most likely how the client programs communicate with the daemon. May 29, 2015 at 0:19
  • @PSkocik, The value is unix:abstract=/tmp/dbus-6xONvYE5r7. I tried setting that variable in the Virtual Terminal but as expected that alone doesn't fix the problem. Any other suggestions?
    – merlin2011
    May 29, 2015 at 0:48
  • You exported too? E.g., export DBUS_SESSION_BUS_ASSRESS="unix:abstract=/tmp/dbus-6xONvYE5r7" ? I'd also try setting and exporting export DISPLAY=:0.0. I think if it works in GUI pseudoterminals, these two exports should make it work in a virtual terminal too (while the GUI session is still on). May 29, 2015 at 0:49
  • @PSkocik, I did export it. Trying the display now also. Setting DISPLAY simply makes it so I can't see the password prompt anymore.
    – merlin2011
    May 29, 2015 at 0:59

1 Answer 1

3

The difference in experience between using pass in a console (what you call a virtual terminal) and within a (GUI) terminal has nothing to do with pass, but with the secret key management done for gpg (as used in the pass scripts) by the gpg-agent.

This gpg-agent is, in modern distributions automatically started with X. You can see this by doing env | fgrep GPG_AGENT from a terminal and one of the consoles. On my Linux Mint 17, this is done by /etc/X11/Xsession.d/90gpg-agent.

As the gpg-agent's man page tells you:

If you don't use an X server, you can also put this into your regular startup file ~/.profile or .bash_profile. It is best not to run multi‐ ple instance of the gpg-agent, so you should make sure that only one is running: gpg-agent uses an environment variable to inform clients about the communication parameters. You can write the content of this envi‐ ronment variable to a file so that you can test for a running agent. Here is an example using Bourne shell syntax:

     gpg-agent --daemon --enable-ssh-support \
               --write-env-file "${HOME}/.gpg-agent-info"

The 90gpg-agent mentioned above is actually smart and tests whether the gpg-agent is already running, but it defaults to using ~/.gnupg/gpg-agent-info-$(hostname).

If your distribution has a similar setup, then you should be able to add the above lines to your ~/.profile (but be sure to use the PIDFILE matching with your X started gpg-agent). You should, in also be able to use the same gpg-agent from multiple consoles by re-evaluating the .gpg-agent-info file.

While trying to set this up, make sure you run pstree | grep -F pgp-agent to make sure there are not more agents running than you need, otherwise it depends on the environment whether "pass" asks for passwords agains and/or between different consoles

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .