Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3E2B073C.8030302@hack.kampbjorn.com> Date: Sun, 19 Jan 2003 21:14:52 +0100 From: Hack Kampbjorn Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en,da,es,ca MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: ssh with one agent for all =?ISO-8859-1?Q?bash=B4s?= References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h0JKcEu17546 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/