Can ssh add keys to ssh-agent?
- From: rozelak@xxxxxxxx
- Date: Wed, 18 Mar 2009 13:26:30 +0100 (CET)
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
- Follow-Ups:
- Re: Can ssh add keys to ssh-agent?
- From: Jeff MacDonald
- Re: Can ssh add keys to ssh-agent?
- Prev by Date: sshd waiting 5 seconds between make fork and establish connection
- Next by Date: Re: ssh 5 second wait.
- Previous by thread: sshd waiting 5 seconds between make fork and establish connection
- Next by thread: Re: Can ssh add keys to ssh-agent?
- Index(es):
Relevant Pages
|