ssh with one agent for all bash´s

Hack Kampbjorn cygwin@hack.kampbjorn.com
Mon Jan 20 09:51:00 GMT 2003


Nicolaie Szabadkai wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>> Hi,
>> looking up the mailinglist and testing a while I figured out that with
> following .bash_profile, I can have one ssh-agent thruoghout all sessions I
> open!
> Once the agent is running the following shells use it again!

That's what keychain is for. Any special reason to reinvent the wheel, 
instead of using standard cygwin packages?
sdesc: "An OpenSSH key manager"
ldesc: "Keychain is an OpenSSH key manager, typically run from
~/.bash_profile. When run, it will make sure ssh-agent is running; if
not, it will start ssh-agent. It will redirect ssh-agent's output to
~/.ssh-agent, so that cron jobs that need to use ssh-agent keys can
simply source this file and make the necessary passwordless ssh
connections. In addition, when keychain runs, it will check with
ssh-agent and make sure that the ssh RSA/DSA keys that you specified on
the keychain command line have actually been added to ssh-agent. If not,
you are prompted for the appropriate passphrases so that they can be
added by keychain."
If these descriptions weren't clear to you, any improvement to them are 
welcome.
>> Although the first shell will not close by it self till the last one is
> gone.
> May be helpfull for anybody using ssh!
>> #!/bin/bash
> trap '
> if [ "$(ps -fu `id -un`|grep -c bash)" -eq 2 ]
> then
> test -n "$SSH_AGENT_PID" && eval `ssh-agent -k` ;
> setx.exe SSH_AGENT_PID "";
> setx.exe SSH_AUTH_SOCK "";
> fi
> ' 0
>> ...
>> if [ "$SSH_AUTH_SOCK" = "" ]
> then
> eval `ssh-agent`;
> /usr/bin/tty > /dev/null && ssh-add $HOME/.ssh/id_dsa;
> setx.exe SSH_AGENT_PID $SSH_AGENT_PID;
> setx.exe SSH_AUTH_SOCK $SSH_AUTH_SOCK;
> fi
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.0
>> iQA/AwUBPiq++50aiFY+2vypEQKafQCdF+35SKzOgXQtK4PkQwpSowPzeaMAoI46
> nONcpKXrLfs/ww3jdFTl6B0o
> =Gurg
> -----END PGP SIGNATURE-----
>>>> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
>>
-- 
Med venlig hilsen / Kind regards
Hack Kampbjørn
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /