# ssh-add doesn't work anymore

## mschmarck

Hello.

Today I rebooted my ~x86 system and find, that I cannot add SSH keys to the SSH key agent anymore. I'm using Gnome 2.22 and thus seahorse/gnome-keyring is used as the key agent.

When I try to add keys, I get:

```
--($:~)-- ssh-add 

Could not open a connection to your authentication agent.
```

Doesn't look good, does it?   :Confused: 

The ssh-add(1) man page states, that ssh-add tries to communicate with the authentication agent over the "file" set in the SSH_AUTH_SOCK environment variable.

```
--($:~)-- echo $SSH_AUTH_SOCK 

/tmp/keyring-L12w0n/ssh

--($:~)-- ps awux | grep keyri

mike      8073  0.0  0.2  16216  2632 ?        SL   07:18   0:00 /usr/bin/gnome-keyring-daemon --foreground --components=keyring

--($:~)-- ps awux | grep agent

mike      6631  0.0  1.8  36876 16776 ?        Ss   07:14   0:00 /usr/bin/seahorse-agent --execute gnome-session
```

This means, that seahorse is running and also gnome-keyring-daemon runs. The environment variable SSH_AGENT_PID is NOT set (which might be fine, as I'm not using the plain ssh keyagent, but the Gnome 2.22 counterparts).

Any ideas about why this no longer seems to work? What did I break?

```
--($:~)-- strace ssh-add 

execve("/usr/bin/ssh-add", ["ssh-add"], [/* 67 vars */]) = 0

uname({sys="Linux", node="winnb000488", ...}) = 0

brk(0)                                  = 0x81b9000

brk(0x81b9cb0)                          = 0x81b9cb0

set_thread_area({entry_number:-1 -> 6, base_addr:0x81b9830, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0

brk(0x81dacb0)                          = 0x81dacb0

brk(0x81db000)                          = 0x81db000

open("/dev/null", O_RDWR|O_LARGEFILE)   = 3

close(3)                                = 0

getpid()                                = 21049

open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 3

fstat64(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0

poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 10) = 1

read(3, "\344\24\266>21/\20\263\235GN\206\265k\23\327\5\233K\27\336i\350\315\20\300\232]z%1", 32) = 32

close(3)                                = 0

brk(0x81da000)                          = 0x81da000

getuid32()                              = 10001

time(NULL)                              = 1208325232

socket(PF_FILE, SOCK_STREAM, 0)         = 3

fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0

connect(3, {sa_family=AF_FILE, path="/tmp/keyring-L12w0n/ssh"}, 110) = -1 ECONNREFUSED (Connection refused)

close(3)                                = 0

write(2, "Could not open a connection to y"..., 58Could not open a connection to your authentication agent.

) = 58

exit_group(2)                           = ?

--($:~)-- ls -la /tmp/keyring-L12w0n/ssh

srwxr-xr-x 1 mike   users 0 16. Apr 07:14 /tmp/keyring-L12w0n/ssh
```

Hm. Whatever should be reading from the /tmp/keyring-L12w0n/ssh pipe doesn't respond, it seems.

Hm²:

```
--($:~)-- sudo lsof|grep -i tmp/keyring

lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/mike/.gvfs

      Output information may be incomplete.

gnome-key  8073     mike      3u     unix 0xe2fd51c0               16680 /tmp/keyring-TEj1nP/socket

gnome-key  8073     mike     13u     unix 0xe2e8ee00               16783 /tmp/keyring-TEj1nP/socket
```

Do I interprete that output right, that there indeed is no program running which reads from /tmp/keyring-L12w0n/ssh and that even the directory /tmp/keyring-L12w0n is wrong?

Here's a list of updated packages since my last boot:

```
drwxr-xr-x 2 root root 800 14. Apr 07:59 /var/db/pkg/sys-apps/portage-2.1.5_rc3

drwxr-xr-x 2 root root 752 14. Apr 08:00 /var/db/pkg/media-libs/libpng-1.2.26-r1

drwxr-xr-x 2 root root 800 14. Apr 08:00 /var/db/pkg/sys-apps/pciutils-3.0.0

drwxr-xr-x 2 root root 720 14. Apr 08:00 /var/db/pkg/net-wireless/bluez-libs-3.30

drwxr-xr-x 2 root root 720 14. Apr 08:01 /var/db/pkg/app-portage/eix-0.12.4

drwxr-xr-x 2 root root 776 14. Apr 08:02 /var/db/pkg/app-editors/jedit-4.3_pre13

drwxr-xr-x 2 root root 800 14. Apr 08:03 /var/db/pkg/x11-libs/cairo-1.6.4

drwxr-xr-x 2 root root 744 14. Apr 08:04 /var/db/pkg/sys-devel/autoconf-2.62

drwxr-xr-x 2 root root 800 14. Apr 08:09 /var/db/pkg/sys-apps/coreutils-6.10-r2

drwxr-xr-x 2 root root 760 14. Apr 08:10 /var/db/pkg/sys-apps/debianutils-2.28.4

drwxr-xr-x 2 root root 776 14. Apr 08:11 /var/db/pkg/net-misc/neon-0.28.2

drwxr-xr-x 2 root root 848 14. Apr 08:52 /var/db/pkg/sys-kernel/tuxonice-sources-2.6.24-r5

drwxr-xr-x 2 root root 776 14. Apr 08:56 /var/db/pkg/dev-ruby/rubygems-1.1.1

drwxr-xr-x 2 root root 744 14. Apr 08:57 /var/db/pkg/x11-misc/x11vnc-0.9.3

drwxr-xr-x 2 root root 776 14. Apr 09:28 /var/db/pkg/dev-python/pyopenssl-0.6-r1

drwxr-xr-x 2 root root 784 14. Apr 09:28 /var/db/pkg/net-zope/zopeinterface-3.0.1-r1

drwxr-xr-x 2 root root 752 14. Apr 09:28 /var/db/pkg/dev-python/twisted-2.5.0

drwxr-xr-x 2 root root 728 14. Apr 09:28 /var/db/pkg/dev-python/twisted-web-0.7.0

drwxr-xr-x 2 root root 776 14. Apr 09:30 /var/db/pkg/net-dns/avahi-0.6.22-r1

drwxr-xr-x 2 root root 784 14. Apr 09:35 /var/db/pkg/net-misc/nxclient-3.2.0

drwxr-xr-x 2 root root 824 14. Apr 09:37 /var/db/pkg/net-misc/openssh-5.0_p1-r1

drwxr-xr-x 2 root root 784 14. Apr 09:44 /var/db/pkg/media-gfx/imagemagick-6.4.0.6

drwxr-xr-x 2 root root 776 14. Apr 09:47 /var/db/pkg/dev-libs/glib-2.16.3

drwxr-xr-x 2 root root 776 14. Apr 09:48 /var/db/pkg/x11-libs/pango-1.20.2

drwxr-xr-x 2 root root 776 14. Apr 09:56 /var/db/pkg/x11-libs/gtk+-2.12.9-r2

drwxr-xr-x 2 root root 776 14. Apr 09:57 /var/db/pkg/gnome-base/gail-1.22.1

drwxr-xr-x 2 root root 776 14. Apr 09:58 /var/db/pkg/x11-libs/libwnck-2.22.1

drwxr-xr-x 2 root root 760 14. Apr 09:58 /var/db/pkg/gnome-base/gnome-menus-2.22.1

drwxr-xr-x 2 root root 776 14. Apr 10:05 /var/db/pkg/dev-cpp/gtkmm-2.12.7

drwxr-xr-x 2 root root 752 14. Apr 10:05 /var/db/pkg/dev-cpp/gconfmm-2.22.0

drwxr-xr-x 2 root root 752 14. Apr 10:07 /var/db/pkg/dev-cpp/libgnomemm-2.22.0

drwxr-xr-x 2 root root 776 14. Apr 10:08 /var/db/pkg/gnome-base/gvfs-0.2.3

drwxr-xr-x 2 root root 776 14. Apr 10:10 /var/db/pkg/media-libs/swfdec-0.6.4

drwxr-xr-x 2 root root 784 14. Apr 10:10 /var/db/pkg/x11-libs/gtksourceview-2.2.1

drwxr-xr-x 2 root root 816 14. Apr 11:13 /var/db/pkg/x11-drivers/nvidia-drivers-169.12

drwxr-xr-x 2 root root 744 14. Apr 11:14 /var/db/pkg/app-arch/rpm-4.4.6-r4

drwxr-xr-x 2 root root 776 14. Apr 11:14 /var/db/pkg/media-sound/alsa-utils-1.0.16

drwxr-xr-x 2 root root 752 14. Apr 11:14 /var/db/pkg/net-wireless/ipw3945-1.2.2-r1

drwxr-xr-x 2 root root 808 14. Apr 11:16 /var/db/pkg/dev-util/subversion-1.4.6-r2

drwxr-xr-x 2 root root 792 14. Apr 11:28 /var/db/pkg/net-www/netscape-flash-9.0.124.0

drwxr-xr-x 2 root root 760 14. Apr 11:29 /var/db/pkg/x11-themes/gtk-engines-2.14.1

drwxr-xr-x 2 root root 760 14. Apr 11:29 /var/db/pkg/gnome-extra/swfdec-gnome-2.22.2

drwxr-xr-x 2 root root 752 14. Apr 11:30 /var/db/pkg/gnome-extra/gcalctool-5.22.1

drwxr-xr-x 2 root root 752 14. Apr 11:30 /var/db/pkg/net-misc/vinagre-0.5.1

drwxr-xr-x 2 root root 776 14. Apr 11:35 /var/db/pkg/gnome-base/gnome-vfs-2.22.0

drwxr-xr-x 2 root root 776 14. Apr 11:36 /var/db/pkg/gnome-base/libgnomeui-2.22.1

drwxr-xr-x 2 root root 760 14. Apr 11:37 /var/db/pkg/gnome-base/gnome-desktop-2.22.1

drwxr-xr-x 2 root root 776 14. Apr 11:39 /var/db/pkg/gnome-base/nautilus-2.22.2

drwxr-xr-x 2 root root 760 14. Apr 11:40 /var/db/pkg/dev-libs/libgweather-2.22.1.1

drwxr-xr-x 2 root root 776 14. Apr 11:45 /var/db/pkg/www-client/epiphany-2.22.1.1

drwxr-xr-x 2 root root 784 14. Apr 11:48 /var/db/pkg/gnome-base/control-center-2.22.1

drwxr-xr-x 2 root root 800 14. Apr 11:51 /var/db/pkg/media-gfx/graphviz-2.18

drwxr-xr-x 2 root root 760 14. Apr 11:53 /var/db/pkg/dev-cpp/libgnomecanvasmm-2.22.0

drwxr-xr-x 2 root root 760 14. Apr 11:56 /var/db/pkg/dev-cpp/libgnomeuimm-2.22.0

drwxr-xr-x 2 root root 760 14. Apr 11:57 /var/db/pkg/gnome-extra/nautilus-cd-burner-2.22.1

drwxr-xr-x 2 root root 776 14. Apr 11:59 /var/db/pkg/app-editors/gedit-2.22.1

drwxr-xr-x 2 root root 760 14. Apr 11:59 /var/db/pkg/dev-libs/totem-pl-parser-2.22.2

drwxr-xr-x 2 root root 776 14. Apr 12:02 /var/db/pkg/media-video/totem-2.22.1

drwxr-xr-x 2 root root 752 14. Apr 12:07 /var/db/pkg/app-office/abiword-2.6.2

drwxr-xr-x 2 root root 776 14. Apr 12:11 /var/db/pkg/gnome-extra/yelp-2.22.1

drwxr-xr-x 2 root root 784 14. Apr 12:12 /var/db/pkg/gnome-extra/gnome-screensaver-2.22.2

drwxr-xr-x 2 root root 776 14. Apr 12:14 /var/db/pkg/net-im/ekiga-2.0.12

drwxr-xr-x 2 root root 776 14. Apr 12:15 /var/db/pkg/net-misc/vino-2.22.1

drwxr-xr-x 2 root root 808 14. Apr 12:28 /var/db/pkg/media-video/vlc-0.9.0_alpha20080409

drwxr-xr-x 2 root root 768 14. Apr 12:30 /var/db/pkg/www-client/epiphany-extensions-2.22.1

drwxr-xr-x 2 root root 800 14. Apr 12:33 /var/db/pkg/app-crypt/seahorse-2.22.1

drwxr-xr-x 2 root root 784 14. Apr 12:33 /var/db/pkg/app-arch/file-roller-2.22.2

drwxr-xr-x 2 root root 784 14. Apr 12:34 /var/db/pkg/gnome-base/gnome-session-2.22.1.1

drwxr-xr-x 2 root root 784 14. Apr 12:37 /var/db/pkg/gnome-base/gnome-applets-2.22.1

drwxr-xr-x 2 root root 808 14. Apr 12:41 /var/db/pkg/gnome-extra/gnome-games-2.22.1.1

drwxr-xr-x 2 root root 760 14. Apr 12:43 /var/db/pkg/gnome-extra/deskbar-applet-2.22.1

drwxr-xr-x 2 root root 800 14. Apr 13:19 /var/db/pkg/kde-base/kdelibs-3.5.9-r1

drwxr-xr-x 2 root root 760 14. Apr 13:21 /var/db/pkg/kde-misc/kdnssd-avahi-0.1.2

drwxr-xr-x 2 root root 760 15. Apr 07:42 /var/db/pkg/sys-fs/device-mapper-1.02.25

drwxr-xr-x 2 root root 840 15. Apr 07:42 /var/db/pkg/sys-apps/net-tools-1.60_p20071202044231

drwxr-xr-x 2 root root 792 15. Apr 07:44 /var/db/pkg/app-arch/tar-1.20

drwxr-xr-x 2 root root 768 15. Apr 07:44 /var/db/pkg/sys-fs/udev-120

drwxr-xr-x 2 root root 760 15. Apr 07:46 /var/db/pkg/media-sound/vorbis-tools-1.2.0-r1

drwxr-xr-x 2 root root 800 15. Apr 07:47 /var/db/pkg/sys-libs/pam-1.0.0-r2

drwxr-xr-x 2 root root 752 15. Apr 07:58 /var/db/pkg/sys-fs/cryptsetup-1.0.6

drwxr-xr-x 2 root root 784 15. Apr 08:52 /var/db/pkg/gnome-base/gnome-panel-2.22.1.2

drwxr-xr-x 2 root root 824 15. Apr 08:55 /var/db/pkg/net-print/cups-1.3.7-r1
```

Anyone else having problems with ssh-add lately? What might be causing this?

Thanks a lot for your time!

----------

## pilla

Looks more like a problem in your ssh agent than ssh-add. I suggest you should clean up tmp, and try to start a ssh-agent from command line. Then, run ssh-agent to see if it can connect to that agent. If it can, then you know that something is broken on Gnome land (2.22 is still far from stable).

----------

## mschmarck

I now did, as you suggested.

```
--($:~)-- ssh-agent 

SSH_AUTH_SOCK=/tmp/ssh-ClGrb14086/agent.14086; export SSH_AUTH_SOCK;

SSH_AGENT_PID=14087; export SSH_AGENT_PID;

echo Agent pid 14087;

--($:~)-- SSH_AUTH_SOCK=/tmp/ssh-ClGrb14086/agent.14086; export SSH_AUTH_SOCK;

--($:~)-- SSH_AGENT_PID=14087; export SSH_AGENT_PID;

--($:~)-- ssh-add 

Enter passphrase for /home/mike/.ssh/id_rsa: 
```

So, yes, ssh-add would work.

It would be interesting to find out, if other Gnome 2.22 users have similar issues. Or "at least", to find out what's reading the ssh named pipe on working systems (IOW: what's the output of the lsof command I posted)?

----------

## pilla

I think it' s worth posting a link in the big gnome 2.22 thread to this thread, asking for input.

However, seahorse shouldn' t be the issue here (AFAIK it' s only a gpg agent, not a ssh one -- gpg is for email cryptography and identity, and ssh is for remote login and file copy through sftp/scp).  

I' ve done a test on gnome-keyring-daemon and I could add a key without issues. 

```

 % /usr/bin/gnome-keyring-daemon --foreground --components=keyring &

GNOME_KEYRING_SOCKET=/tmp/keyring-YMo615/socket

GNOME_KEYRING_PID=7027

% SSH_AUT_SOCK=/tmp/keyring-YMo615/socket ssh-add .ssh/id_dsa_test

Identity added: .ssh/id_dsa_test (.ssh/id_dsa_test)

%lsof /tmp/keyring-YMo615/socket 

COMMAND    PID  USER   FD   TYPE             DEVICE SIZE  NODE NAME

gnome-key 7027 pilla    3u  unix 0xffff810045c81000      13633 /tmp/keyring-YMo615/socket

```

My config: ~amd64, gnome-keyring-2.22.0-r2

----------

