9

I recently stopped using a full desktop environment in ubuntu 11.10 (tired of unity) but I'm trying to get some of the desktop environment back. I'm currently trying to get the "Unlock private key" dialog to show up when I'm trying to use a new ssh key. However, currently the prompt only shows up in the terminal window instead of the gui, which means that it isn't using a global ssh-agent and hence I need to enter the key password multiple times before I restart.

I think what I want is gnome-ssh-askpass and I tried setting SSH_ASKPASS but that didn't work: http://www.linuxquestions.org/questions/linux-software-2/how-to-replace-ssh-askpass-with-ssh-askpass-gnome-843220/

I've also tried gnome-keyring-daemon as gnome-keyring-daemon --components keyring,pkcs11,ssh but that didn't help: http://live.gnome.org/GnomeKeyring/Ssh

2
  • Did you ever find an answer? I would love to hear.
    – asoundmove
    Mar 20, 2017 at 23:57
  • Sorry, don't remember what I ended up doing. Mar 21, 2017 at 23:50

5 Answers 5

3

I think what you're really looking for is keychain, which is similar to the ssh-reagent you mention. Once configured in your .bashrc it'll prompt for the passphrase of the key(s) you asked it to manage only when you launch the first terminal after login and makes sure every new terminal knows about your ssh-agent.

2

To resolve the issue of entering the password multiple times, enter this command the first time you open a terminal: ssh-add


No need to enter the password until you log out.

2
  • I don't really like that solution because it's irritating doing that for every new terminal window (I tend to make many windows). I currently use ssh-reagent pastebin.com/HBeUzZhs but even doing that in every window is irritating so I might add it to my .zshrc Jan 18, 2012 at 19:17
  • 1
    No need to do it for every window, once is enough.
    – koni_raid
    Jan 27, 2012 at 8:19
1

It should be automatic if you've set up the ssh key on both systems. With a default installation, I've never had to do anything else.

In case you haven't done this, here is the way it's done:

Generate the key (either RSA or DSA). I think RSA is more common.

ssh-keygen -t rsa

or

ssh-keygen -t dsa

Transfer the key to the remote system:

ssh-copy-id *username* @ *hostname*

If not using the standard port 22: (note quotes are required around argument)

ssh-copy-id *username* @ *hostname* -p *portnum*"

If using DSA, you need to use a something like:

ssh-copy-id -i *path*  *to*   id_dsa

Once I've done that, I get the dialog. In the past, I remember that if I ran the terminal in a certain way, it wouldn't give the dialog, but I can't remember the details. I think it was when I created a hotkey for a custom command to set the directory due to a bug where the terminal kept coming up in the root directory even though it knew my home directory.

0
0

I've added this as a new answer because I didn't want it to get last in my other answer.

I have found that if you start gnome-terminal, or xterm or other terminals (I believe) from a custom hotkey rather than the built in hotkey or menu, then it behaves totally differently for SSH, and will not use the keyring. In fact, when I just tried it on my system after remembering this problem, I actually got an error, where it always works from the default methods.

4
  • This might be related since I am using Awesome WM's Super+Enter shortcut to launch the terminal. Feb 23, 2012 at 20:48
  • Do you run Awesome with Gnome? If so, maybe you can get the SSH working with the standard WM first, then if that works, you'll know where to look for solutions. Feb 24, 2012 at 17:42
  • It was working fine before I switched to AwesomeWM Feb 24, 2012 at 20:08
  • Well, wish I could help further. I tried taking a look at Awesome once, but never got far, and didn't feel like spending a lot of time figuring it out. It looks like it might be interesting, but I don't know that it really does anything I can't do with Compiz, except maybe using less resources. Feb 24, 2012 at 21:01
0

If gnome's gui doesn't prompt you for the password it could mean that gnome-keyring-d is not running or it is in an invalid state. I would check if the process is running:

ps -e | grep gnome-keyring-d

If it is then kill it:

killall -9 gnome-keyring-d

Then restart it

gnome-keyring-daemon

After that when I do ssh <remotehost> I get the gui prompt and the ssh-agent under the hood doing it's job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .