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




Relevant Pages

  • Re: Q: add an ssh login failure delay like it is for plain login
    ... With ssh, the sshd child ... terminates after an failed attempt is made. ...
    (comp.os.linux.misc)
  • OpenSSH, PAM and kerberos
    ... bug in OpenSSH: currently sshd do pam_authenticateand ... pam_acct_mgmtfrom child process, but pam_setcredfrom paren ...
    (FreeBSD-Security)
  • Re: OpenSSH, PAM and kerberos
    ... currently sshd do pam_authenticateand ... pam_acct_mgmtfrom child process, but pam_setcredfrom paren ... proccess. ... pam_krb5 in pam_sm_setcredrequired information from ...
    (FreeBSD-Security)
  • RE: Who to run sshd as
    ... but when ever someone logs in a child process starts ... privileges than you allow that user. ... Who to run sshd as ... but that user does not have permission to bind the socket. ...
    (SSH)