I stumbled across this problem when I decided to switch completely to this fantastic window manager called Xmonad.
I use SSH a lot and I also use Ubuntu's cloud service(UbuntuOne). I use public key logins in most of the hosts I SSH into, so in order not to unlock my key each time I wanted to SSH or SCP to another host I used the GNOME keyring to store the unlocked key. And UbuntuOne uses the keyring to store the password to use to login to the service.
When I started using Xmonad I lost the keyring and I was becoming mad. So I started searching on how I could enable it in my Xmonad session. I couldn't find a definite guide so I investigated a little bit of how the keyring worked and I'm explaining here what to do in order to have the gnome keyring start after the login and having it fully functional with the ssh.
First of all you need to change the file in
/usr/share/xsessions/xmonad.desktop in order to execute a script of ours instead of the xmonad. It will look like this:
[Desktop Entry] Encoding=UTF-8 Name=XMonad Comment=Lightweight tiling window manager Exec=xmonad.start Icon=xmonad.png Type=XSession
Now we are going to have the script (with executable privileges) somewhere in the path, a correct place to have it is
/usr/local/bin. So a simple
/usr/local/bin/xmonad.start script would be:
#!/bin/bash #most basic xmodmap stuff xmodmap -e 'remove Lock = Caps_Lock' xmodmap -e 'keysym Caps_Lock = Control_L' xmodmap -e 'add Control = Control_L' xmodmap -e 'keycode 166 = Hyper_R' xmodmap -e 'add mod5 = Hyper_R' ~/.xmonadrc exec xmonad
Basically what this file does is mapping some keys and executing a script
.xmonadrc in the home of the user. This is done in order to allow different users set different settings. In that script is where the magic will happen, but with that magic won't be enough. Here's what you have to include in that file in order to start the keyring. In my file I set up a trayer and launch some other programs.
eval $(gnome-keyring-daemon --start) export GNOME_KEYRING_SOCKET export GNOME_KEYRING_PID
Those three commands will launch the keyring daemon and set up the environmental variables needed to make it work. This will work perfectly with the stored passwords but ssh's keyring overrides this gnome keyring and the unlocking of the ssh key won't work (don't know why yet).
In order to correct this it is necessary to update the
.profile in the home of your user. You need to append the following line:
With that the ssh will use the keyring daemon and we are ready to use it for everything. Just restart gdm or re-log into the user.
Hope it was useful.