[CentOS] ssh-agent

Tue Apr 6 17:10:20 UTC 2010
Les Mikesell <lesmikesell at gmail.com>

On 4/6/2010 11:56 AM, m.roth at 5-cent.us wrote:
>>> On 4/6/2010 10:46 AM, m.roth at 5-cent.us wrote:
>>>> Todd wrote:
>>>>> m.roth at 5-cent.us wrote, On 04/06/2010 10:51 AM:
>>>>>> What I was doing: log onto my machine (system run level 5, I log out,
>>>>>> NOT just lock the screen, every single night; therefore, there should
>>>>>> be no processes running owned by me), and in a terminal window, do
>>>>>>      ssh-agent
>>>>>>      ssh-add .ssh/private key
>>>>>> and enter my passphrase. Then I'd go through the day merrily on my
>>>>>> way.
>>>>>>
>>>>>> Now, I find that when I log out, ssh-agent IS NOT STOPPED, even
>>>>>> though
>> <snip>
>>>> ps -fu<mylogin>   | grep ssh
>>>> <mylogin>     13313     1  0 Apr02 ?        00:00:00 ssh-agent
>>>> <mylogin>     18049 18019  0 09:09 ?        00:00:00 /usr/bin/ssh-agent
>>>> /bin/sh -c exec -l /bin/bash -c "/usr/bin/dbus-launch
>>>> --exit-with-session
>>>> /etc/X11/xinit/Xclients"
>>>> <snip>
>>>> 9:09 or so was when I used ssh-add. Note that ssh-agent has been
>>>> running
>>>> since the second, and I logged out Friday and yesterday.
>>>
>>> So you have 2 different instances running?
>>
>> Y'know, that's an interesting question, and one I didn't think of. Thing
>> is, I did *not* run ssh-agent when I was logging on this morning, *all* I
>> did was ssh-add. Checking my history, I'm sure of this course of events. I
>> just grepped, as well, and nothing in my . files runs it, nor does
>> anything in /etc/profile or /etc/profile.d.
>
> Following myself up, see it *mentioned*, in comments, in
> /usr/bin/startkde, but that's for startx, not if you're running in level
> 5.
>
> Oh, and the man page for ssh-agent reads, as the last line before "Files":
> "The agent exits automatically when the command given on the command
>       line terminates."
> Which means, to me, that when the xterm that I started it in is closed, it
> should end, unless there's some interpretation other than plain English
> there.

You are reading plain english backwards.  If you give ssh-agent a 
command to run on the command line it exits when the command finishes. 
You didn't give it a command so it became a daemon (which you can see in 
the ps because the parent pid is 1) and will run until something kills 
it.   But, you don't have to start one at all because normal X startup 
will do it for you - and correctly.  You only need to run ssh-add.

-- 
   Les Mikesell
    lesmikesell at gmail.com