Oliver Fromme olli at
Thu Nov 23 01:16:31 PST 2006

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
        if [[ -r "$AGENTFILE" ]]; then
                source "$AGENTFILE"
                export SSH_AGENT_PID=$$
        if [[ -z "$SSH_AGENT_PID" ]] \
           || ! ps -p "$SSH_AGENT_PID" | grep -q ssh-agent; then
                ssh-agent >! "$AGENTFILE"
                source "$AGENTFILE"
        unset AGENTFILE

Best regards

Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD:
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"

More information about the freebsd-stable mailing list