Ask Your Question

Error communicating with gnome-keyring-daemon in SSH session

asked 2014-04-15 19:52:02 -0600

iliekturtles gravatar image

updated 2015-10-19 16:42:24 -0600

On a Fedora 20 machine I have git-credential-gnome-keyring set as my credential.helper. When attempting remote Git operations that require credentials from within a SSH session the following error is given:

** (process:11973): CRITICAL **: Error communicating with gnome-keyring-daemon

These same operations from within the desktop session work without issue. What needs to be done to make gnome-keyring-daemon accessible from within the SSH session? From little I have been able to gather there may be some dbus configuration required but all information I have been able to find so far is specific to non-Fedora distributions.

EDIT: After some digging I find that export DBUS_SESSION_BUS_ADDRESS=... based on the $DBUS_SESSION_BUS_ADDRESS value from my Gnome session allows the remote Git operations to access gnome-keyring-daemon without error in my SSH session. Obviously this isn't a very good solution and wont work when there is no Gnome session. What is the appropriate way to setup DBUS_SESSION_BUS_ADDRESS in a SSH session?

EDIT #2: Here is an example workflow. It was all run locally. Normally I'll be connecting via SSH from another machine and the same results can be demonstrated.

[mike@jrvj rust]$ grep -B1 keyring ~/.gitconfig
        helper = /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring
[mike@jrvj rust]$ git push
Everything up-to-date
[mike@jrvj rust]$ ssh localhost
mike@localhost's password: 
Last login: Thu Apr 17 20:01:36 2014 from asdf
[mike@jrvj ~]$ cd Source/rust
[mike@jrvj rust]$ git push

** (process:15072): CRITICAL **: Error communicating with gnome-keyring-daemon
Username for '': ^C
[mike@jrvj rust]$

Here is another run through demonstrating the hack explained in the first edit where exporting DBUS_SESSION_BUS_ADDRESS allows gnome-keyring-daemon to be accessed.

[mike@jrvj rust]$ echo $DBUS_SESSION_BUS_ADDRESS
[mike@jrvj rust]$ ssh localhost
mike@localhost's password: 
Last login: Thu Apr 17 20:02:49 2014 from localhost.localdomain
[mike@jrvj ~]$ export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-...
[mike@jrvj ~]$ cd Source/rust
[mike@jrvj rust]$ git push
Everything up-to-date
[mike@jrvj rust]$

EDIT #3: I still haven't found a good solution so I've gone with exporting $DBUS_SESSION_BUS_ADDRESS when necessary as described in this thread: .

# Export $DBUS_SESSION_BUS_ADDRESS when connected via SSH to enable access
# to gnome-keyring-daemon.
if [[ -n $SSH_CLIENT ]]; then
    export $(cat /proc/$(pgrep "gnome-session" -u "$USER")/environ | grep -z "^DBUS_SESSION_BUS_ADDRESS=")

EDIT #4: I ended up switching to SSH remote repositories and using git config --global credential.helper 'cache --timeout=14400' for when SSH isn't available.

edit retag flag offensive close merge delete


try ssh -A ?

randomuser gravatar imagerandomuser ( 2014-04-17 00:19:46 -0600 )edit

@randomuser Same error message. Even ssh -A localhost.

iliekturtles gravatar imageiliekturtles ( 2014-04-17 18:09:39 -0600 )edit

Can update your question with a "demonstration" of the workflow you're trying to use - ie exact commands in a quote block? I'm not sure I'm on the same page.

randomuser gravatar imagerandomuser ( 2014-04-17 18:37:20 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-11 13:54:04 -0600

dashesy gravatar image

updated 2016-11-01 10:11:30 -0600

This works for me, this is xfce4 but can be used with other session types:

if [[ -z $DBUS_SESSION_BUS_ADDRESS ]]; then
    pgrep "xfce4-session" -u "$USER" | while read -r line; do
        exp=$(cat /proc/$line/environ | grep -z "^DBUS_SESSION_BUS_ADDRESS=")
        echo export "$exp" > ~/
    if [[ -f ~/ ]]; then
        source ~/

Changing to gnome-session will make this work in gnome sessions.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-04-15 19:52:02 -0600

Seen: 3,454 times

Last updated: Nov 01 '16