[CentOS] ssh-agent

Tue Apr 6 15:15:55 UTC 2010
Bart Schaefer <barton.schaefer at gmail.com>

On Tue, Apr 6, 2010 at 7:51 AM,  <m.roth at 5-cent.us> wrote:
> Now, I find that when I log out, ssh-agent IS NOT STOPPED, even though I
> am logged all the way out. When I log out, unless I background something,
> everything running as me should go away. Everything.

ssh-agent is designed to run in the manner of a daemon process, so
that you can connect to it from multiple clients which may be
associated with independent logins (or with no login at all).

A quick look at "man ssh-agent" would have told you several things:

(1) You can put  a time limit on the life of identities added by
ssh-add, by starting ssh-agent with the -t option.  However, the
default is forever.

(2) You can force ssh-agent to exit when you log out by arranging for
"ssh-agent -k" to run.  How this is accomplished depends on your login
shell; "trap 'ssh-agent -k' EXIT" might be one way if there is no
configuration file read at logout time.

(3) As Todd Denniston pointed out, running ssh-agent with a command to
execute sets up the agent to exit when the command itself completes.
As you're already starting ssh-agent by hand in a terminal window,
that should be almost as easy as "exec ssh-agent $SHELL".