ssh-agent subprocess parentage

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue May 10 07:13:33 EST 2011


On 05/09/2011 04:54 PM, Phil Pennock wrote:
> No, that's not how Unix works.  A child process can't indirectly cause
> its parent to run something without pre-arranged RPCs to communicate
> application-layer instructions to do so, which I doubt your shell has.

I'm pretty sure this is actually how it works.  ssh-agent forks, and is
two processes concurrently.  Each process (the parent and the child)
gets to decide what to do next.  In ssh-agent, the parent process
exec()'s the subcommand, while the child process lives on as an agent.

Search for "fork" in ssh-agent.c to see what i'm talking about.

> There is a common idiom to use:
>   eval `ssh-agent -s`
> to set up ssh which results in the process layout you describe.  This is
> probably happening somewhere that you just haven't tracked down yet.

This does *not* result in the process layout i describe -- this results
in a daemonized process via a forking and dying parent (that is, only
the child process remains, and its parent becomes PID 1).  This
arrangement is even harder to supervise properly.

	--dkg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1030 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20110509/f678d46e/attachment-0001.bin>


More information about the openssh-unix-dev mailing list