ssh exit mechanism!

Markus Friedl markus at
Fri Oct 12 02:49:29 EST 2001

On Wed, Oct 10, 2001 at 09:24:53AM +0100, hari sekar wrote:
> To whomsoever it may concern,
>     I use putty-0.51 as ssh client on windows and
> openssh-2.9p2 implementation on RedHat 7.0 Linux as
> ssh server. For the client to exit, I expected ssh
> client to send SSH_CMSG_EOF to the server and the
> server respond with SSH_CMSG_EXITSTATUS and finally
> close the connection when the client sends
> SSH_CMSG_EXIT_CONFIRMATION. This will effectively end
> the server_loop in the server. This would close the
> connection in a cleaner way. Although the RFC has
> stated that either side may send SSH_MSG_DISCONNECT,
> for immediate disconnect, I am surprised that this is
> the normal exit method used in putty implementation. 
>        I fear that any addition of code after
> server_loop, to be done once the connection is closed
> by the server might not get called, as it now is
> redirected to fatal_cleanup(). 
>      Is this normal and do other implementations
> follow this?

openssh's client waits for SSH_CMSG_EXITSTATUS.

>    And I would also like to know about the ssh
> hang-on-exit problem. Why is it necessary to redirect
> stdin to /dev/null to prevent this? How does this end
> processes running in background?

because EOF on PTY's is different on different unices.

More information about the openssh-unix-dev mailing list