English
Ask Your Question
1

Error communicating with gnome-keyring-daemon in SSH session

asked 2014-04-16 00:52:02 +0000

iliekturtles gravatar image

updated 2015-10-19 21:42:24 +0000

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
[credential]
        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 'https://github.com': ^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
unix:abstract=/tmp/dbus-...
[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: http://ubuntuforums.org/showthread.ph... .

# 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=")
fi

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

Comments

try ssh -A ?

randomuser ( 2014-04-17 05:19:46 +0000 )edit

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

iliekturtles ( 2014-04-17 23:09:39 +0000 )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 ( 2014-04-17 23:37:20 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-10-11 18:54:04 +0000

dashesy gravatar image

updated 2016-11-01 15:11:30 +0000

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" > ~/.exports.sh
        break
    done
    if [[ -f ~/.exports.sh ]]; then
        source ~/.exports.sh
    fi
fi

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.

Question Tools

Follow
1 follower

Stats

Asked: 2014-04-16 00:52:02 +0000

Seen: 2,717 times

Last updated: Nov 01 '16