[Bug 3312] Behavior change in OpenSSH8.1 compared to OpenSSH7.5

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Tue May 18 11:18:03 AEST 2021


Damien Miller <djm at mindrot.org> changed:

           What    |Removed                     |Added
                 CC|                            |djm at mindrot.org

--- Comment #1 from Damien Miller <djm at mindrot.org> ---
sshd has no information of what is running in the user session except:

1) SIGCHILD/waitpid() notifications of process exit
2) File descriptors closing

sshd does see the notifications of process exit for your example. E.g.
if you run in verbose mode (ssh -vvv ...) then you'll see:

> debug1: client_input_channel_req: channel 0 rtype exit-status reply 0

But the child process' stderr file descriptor is still open from ssh'd
perspective and sshd has no way of knowing whether important
information could be coming until the child process closes it.

In your case of running nohup - sshd will see that stderr is still open
and wait for it to close before finalising the session.

> if something in the script were to write to stderr after our sleep has
> happened, we shouldn't be displaying that on the client side, since the
> nohup ought to prevent things from writing to the screen.

This is not entirely correct - nohup will prevent subprocesses from
writing to a *TTY*. There is no TTY involved in your example above
because ssh does not request one when a command is specified on the

If you change your example to request a TTY then it should exit

ssh -tn user at hostname 'nohup /tmp/dosleep > /dev/null &'

You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.

More information about the openssh-bugs mailing list