This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
ssh with one agent for all bash´s
- From: "Nicolaie Szabadkai" <Nicolaie at Szabadkai dot de>
- To: <cygwin at cygwin dot com>
- Date: Sun, 19 Jan 2003 16:06:43 +0100
- Subject: ssh with one agent for all bash´s
- Reply-to: <Nicolaie at Szabadkai dot de>
-----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!
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/