[aklug] Re: ssh-agent?

From: David J. Weller-Fahy <dave-lists-aklug@weller-fahy.com>
Date: Tue Aug 03 2010 - 17:00:01 AKDT

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* Ted Rathkopf <ted@rathkopf.org> [2010-08-01 22:46 -0500]:
> If you are using X windows, it's handy to edit your .startx or
> .xinitrc so that it runs ssh-agent when it starts your session
> manager. Then the session manager and all future processes spawned
> from it are child processes of the ssh-agent and inherit the
> information about the agent, so you don't need to enter your key
> information again that session once you've run ssh-add.

Yep, I use it in my standard bashrc as follows (corrections welcome).

#v+
SSH_ENV="$HOME/.ssh/environment"

function start_agent {
        test "$(uname | tr [A-Z] [a-z])" != "darwin" \
                && test "`which ssh-agent`" != "" \
                && echo "Initialising new SSH agent..." \
                && `which ssh-agent` | sed 's/^echo/#echo/' > "${SSH_ENV}" \
                && echo "succeeded" \
                && chmod 600 "${SSH_ENV}" \
                && . "${SSH_ENV}" > /dev/null #\
# && /usr/bin/ssh-add;
}

# Source SSH settings, if applicable
if test -f "${SSH_ENV}" ; then
        . "${SSH_ENV}" > /dev/null
        ps ax | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
                start_agent;
        }
else
        start_agent;
fi
#v-

That, of course, was amalgamated from multiple sources online, and I
removed the last line of "start_agent" because I kept loading the same
ID over and over. ;)

- --
dave [ please don't CC me ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAkxYu48ACgkQzahokXOb2UyiUgCgqmdlr4q3YJL6Z/wa0pYy8C6h
56wAniZsHZWSd0pTRUon6AV9jtaQCCiW
=x2NY
-----END PGP SIGNATURE-----
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Aug 3 17:00:11 2010

This archive was generated by hypermail 2.1.8 : Tue Aug 03 2010 - 17:00:11 AKDT