ssh-add meets gnome-keyring.
By user12625760 on Aug 24, 2007
Now that we have the gnome keyring for storing passwords in and the excellent pidgin now uses it so I have to type my passphrase in so that pidgin can login it was irritating me that I also have to type in a passphrase for ssh.
So I wrote a small program gnome-keyring.c and a Makefile which wil allow you to store your ssh passphrase in the gnome keyring and then have ssh-add use the same program to retrieve the key. To use it save the two files in a new directory and in that directory type “make”. (This kind of assumes you have a compiler). Then install the resulting binary in your path.
Now to save away your ssh passphrase in the gnome keyring type
: principia IA 35 $; gnome-keyring -s enter password: Reenter password: : principia IA 36 $; gnome-keyring easy to guess : principia IA 37 $;
Now if you set the environment variable SSH_ASKPASS to be gnome-keyring in your .dtprofile eg:
and then have your gnome session call “ssh-add” when the session starts you will be prompted for the gnome-keyring passphrase and you never have to type the ssh one.
I've only tested this on nevada build 71.
Irritatingly after I wrote this I did a google search for “ssh gnome-keyring” and discovered that I had reinvented the wheel, but I enjoyed it.
I've updated the program to be able to cope with having different passphrases for differnent ssh keys. This is a bit of a hack as it relies on the arguments that ssh-add passes to the program to work out which key to use but it works.
: principia IA 169 $; gnome-keyring -s /home/cg13442/.ssh/id_rsa enter password: Reenter password: : principia IA 170 $; gnome-keyring -g /home/cg13442/.ssh/id_rsa not so easy to guess : principia IA 171 $; gnome-keyring -s /home/cg13442/.ssh/id_dsa enter password: Reenter password: : principia IA 172 $; gnome-keyring -g /home/cg13442/.ssh/id_dsa easy to guess : principia IA 173 $;