<div dir="ltr">Years ago, I attempted to fix an issue that sounds a lot like this:<div><a href="https://hg.ucc.asn.au/dropbear/rev/35183e8a7851">https://hg.ucc.asn.au/dropbear/rev/35183e8a7851</a><br></div><div><br></div><div>I believe the right way this works it that:</div><div>- ssh client closes session</div><div>- dropbear closes the read end of command's stdout pipe</div><div>- next time command writes to pipe, it receives SIGPIPE and dies</div><div>Thus I don't think dropbear needs to explicitly kill anything. but perhaps the mechanism is somehow not working.</div><div><br></div><div>I would investigate this by running 'strace' on the remote host and seeing if, after closing the session, 1) dropbear closes the pipe and 2) the command tries to write to it and receives SIGPIPE.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 25, 2021 at 12:52 PM Grant Edwards <<a href="mailto:grant.b.edwards@gmail.com">grant.b.edwards@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I have a small ash script that prints memory statistics once a second:<br>
<br>
    #!/bin/sh<br>
<br>
    while true<br>
    do<br>
        date<br>
        cat /proc/[0-9]*/stat |<br>
        awk '$23 > 0 {printf "%5d %20s  %8d  %5d\n", $1, $2, $23, $24}' |<br>
        sort -n<br>
        sleep 60<br>
    done<br>
<br>
When I run that remotely via dropbea:<br>
<br>
    $ ssh <a href="mailto:root@10.0.0.99" target="_blank">root@10.0.0.99</a> ./showmem.sh<br>
<br>
Everything works as expected while the ssh session is active, but when<br>
I end the ssh connection, the shell script never terminates: it<br>
continues to run (indifinitely, AFAICT). I don't recall this happening<br>
when we used to use openssh's server. Is there any way to get dropbear<br>
to terminate a "child" program when the ssh session closes?<br>
<br>
<br>
<br>
<br>
</blockquote></div>