Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Nov 2006 10:16:19 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-stable@FreeBSD.ORG, stefan.thurner@mb.tu-chemnitz.de
Subject:   Re: pam.d/sshd
Message-ID:  <200611230916.kAN9GJXe082669@lurza.secnetix.de>
In-Reply-To: <Pine.LNX.4.64.0611230934390.18434@herkules.hrz.tu-chemnitz.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Stefan Thurner wrote:
 > I would like to activate ssh-agent automatically if I login 
 > via ssh.

As far as I know there is no mechanism to start ssh-agent
automatically.  (Someone please correct me if I'm wrong.)

Personally I have the following snippet in my ~/.zshrc
which starts ssh-agents if it isn't already running.
It also works if the home directory is shared across
multiple machines.

if [[ $EUID -ne 0 ]]; then
        AGENTFILE="${HOME}/.ssh-agent.${HOST%%.*}"
        if [[ -r "$AGENTFILE" ]]; then
                source "$AGENTFILE"
        else
                export SSH_AGENT_PID=$$
        fi
        if [[ -z "$SSH_AGENT_PID" ]] \
           || ! ps -p "$SSH_AGENT_PID" | grep -q ssh-agent; then
                ssh-agent >! "$AGENTFILE"
                source "$AGENTFILE"
        fi
        unset AGENTFILE
fi

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"Life is short (You need Python)"
        -- Bruce Eckel, ANSI C++ Comitee member, author
           of "Thinking in C++" and "Thinking in Java"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611230916.kAN9GJXe082669>