Can ssh add keys to ssh-agent?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hallo, I would like to ask a simple question. Please take my apologies
it it has already been addressed, but I didn't find answer for it.

I have key-based access to a ssh server (running openssh) and ssh-agent
running. When I add the key to agent (ssh-add ...), everything works
as expected without problems. I have also set 'IdentityFile = path_to_key'
to that key in ~/.ssh/config. Now, when I use ssh and the key IS NOT
added to ssh-agent, ssh asks for the password to the key and uses it
for authentication. Still no problem. Also when I use e.g. subversion
(using svn+ssh protocol) from command line, it (or the ssh) asks for
the password to the key and again, uses the key for the authentication
to the server.

However, when I use sh or subversion again, it asks for the password
to the key again; everytime I use it. It looks like:

$ ssh-add -L
The agent has no identities.

$ svn up
Enter passphrase for key 'path_to_key_from_IdentityFile': 
....
....

$ ssh-add -L
The agent has no identities.

$ svn log
Enter passphrase for key 'path_to_key_from_IdentityFile': 
....
....

$ ssh svnserver
Enter passphrase for key 'path_to_key_from_IdentityFile':
....
^D

$ ssh-add -L
The agent has no identities.



Well, it is correct, and you may argue that I should add the key to the
running agent, using ssh-add; you are right. Nevertheless, it becomes
annoying when I use a GUI client to svn - it asks for the password again
and again (using X-password dialog), until I switch to console and call
ssh-add. Also when I forget to call ssh-add before I connect by ssh,
it asks repeatedly for the password with each new connection (I ususally
open more than one ssh connection). It is not crucial problem, but I
hope you agree that it is annoying.

So, the question is: is there a possibility to configure ssh to automatically
add the key to running ssh-agent, when the ssh recognises that key is
required and checks that the password is OK (which ssh already does)?
To behave it like:


$ ssh-add -L
The agent has no identities.

$ svn up
Enter passphrase for key 'path_to_key_from_IdentityFile': 
....
....

$ ssh-add -L
ssh-dss xxxxxxxxxxxx ..... xxxxxxxxxxxx path_to_key_from_IdentityFile

$ svn log
....
....

$ ssh svnserver
....
^D


It would allow to use the key once it is needed, and even GUI-based apps
could set it without the need to switch to console.


Tank you very much for your answer. Best regards,
Dan



[Index of Archives]     [Open SSH Unix Development]     [Fedora Users]     [Fedora Desktop]     [Yosemite Backpacking]     [KDE Users]     [Gnome Users]

  Powered by Linux