delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/19/10:07:02

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Reply-To: <Nicolaie AT Szabadkai DOT de>
From: "Nicolaie Szabadkai" <Nicolaie AT Szabadkai DOT de>
To: <cygwin AT cygwin DOT com>
Subject: ssh with one agent for all bash´s
Date: Sun, 19 Jan 2003 16:06:43 +0100
Message-ID: <POEFIELAKAJCHGBCEOPLAEBFCJAA.Nicolaie@Szabadkai.de>
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Loop-Detect: 1

-----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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019