Ensuring remote ssh process has terminated



I am curious about some behavior in sshd that I consider to be a bug

I have tried this on openssh-4.2p1-fc4.10 and openssh-4.3p2-16.el5 and
the behavior is the same in both places.

The child process spawned by the sshd does not get killed when the sshd
terminates and the process has been adopted by init. For example:

$ ssh localhost sleep 100
<Ctrl+C>
Killed by signal 2.

$ ps -C sleep -o cmd,pid,ppid
CMD PID PPID
sleep 100 13550 1

This behavior is not intuitive - rsh doesn't behave this way, for
example. If I force tty allocation with '-t', then the child process
will receive SIGINT and terminate. However, this is not an option if I
want to run the process with no standard input. The ssh client will not
allocate a pseudoterminal in this instance.

Is it possible to ensure, without allocating a pseudoterminal, that the
remote process will terminate when the client terminates?

Thanks,
John