I'm not sure whether it's possible to use EOF like that for a session with a PTY terminal.
It's not, and it's a well-known problem with read/write file descriptors - they cannot transfer one-way EOFs. shutdown() was actually added to the BSD socket interface to address this problem, but it's an ad-hoc and half-working solution, and it doesn't work on anything else than sockets. Terminals are complex here because they weren't designed for separate input and output; the terminal model is a single point of management for communication, whether inbound or outbound, and sending half-duplex EOFs isn't supported AFAIK. Dropbear could still catch the write-EOF from the client and not close the pty until the read-EOF also arrives. Or only close it after a configurable timeout; closing as soon as the write-EOF is received is definitely a suboptimal behaviour. -- Laurent
