Yuri
2023-Apr-07 17:13 UTC
Killing the OpenSSH server doesn't cause the Windows OpenSSH client to die
Hi Rob, On 4/7/23 10:08, Bob Rasmussen wrote:> It depends how you "kill" the SSH server. > > If you kill it by sending it a SIGKILL signal, it will NOT notify the > client, so the client will stay running until the client discovers the > connection is broken.I run 'kill <pid>' which sends SIGTERM. This should shout it down gracefully. But even with SIGKILL the OS would still shut down the network connection gracefully, and this should be propagated to the client. Yuri
rsbecker at nexbridge.com
2023-Apr-07 17:36 UTC
Killing the OpenSSH server doesn't cause the Windows OpenSSH client to die
On Friday, April 7, 2023 1:13 PM, Yuri wrote:>On 4/7/23 10:08, Bob Rasmussen wrote: >> It depends how you "kill" the SSH server. >> >> If you kill it by sending it a SIGKILL signal, it will NOT notify the >> client, so the client will stay running until the client discovers the >> connection is broken. > > >I run 'kill <pid>' which sends SIGTERM. This should shout it down >gracefully. > >But even with SIGKILL the OS would still shut down the network >connection gracefully, and this should be propagated to the client.Windows sometimes keeps sockets around until TTL expires. If you have Cygwin or similar, netstat -a will show you any sockets that are around but no longer connected (FIN-WAIT). If a process tries to bind to a bound socket on the same port during that period, the bind may fail (it does not on some platforms). --Randall
mike tancsa
2023-Apr-11 17:09 UTC
Killing the OpenSSH server doesn't cause the Windows OpenSSH client to die
On 4/7/2023 1:13 PM, Yuri wrote:> On 4/7/23 10:08, Bob Rasmussen wrote: >> It depends how you "kill" the SSH server. >> >> If you kill it by sending it a SIGKILL signal, it will NOT notify the >> client, so the client will stay running until the client discovers >> the connection is broken. > > > I run 'kill <pid>' which sends SIGTERM. This should shout it down > gracefully. >The <pid> you reference, is that the process for the actual windows client connection that was spawned off, or the server. If the server, the existing connections will still live. e.g. here are all the ssh processes on a FreeBSD server. If I kill the master (pid 865), my session is still alive. I just cant get new ones #? ps -auxwww | grep ssh root?????? 865?? 0.0? 0.2? 21072? 8816? -? Ss?? Thu11 0:00.00 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups (sshd) root???? 12441?? 0.0? 0.2? 21144? 9372? -? Ss?? 13:01 0:00.02 sshd: mike [priv] (sshd) mike 12443?? 0.0? 0.2? 21144? 9644? -? S??? 13:01?????? 0:00.01 sshd: mike at pts/0 (sshd) root???? 12458?? 0.0? 0.1? 12816? 2340? 1? S+?? 13:01 0:00.00 grep ssh # kill 865 # ps -auxwww | grep ssh root???? 12441?? 0.0? 0.2? 21144? 9372? -? Is?? 13:01 0:00.02 sshd: mike [priv] (sshd) mike? 12443?? 0.0? 0.2? 21144? 9644? -? S??? 13:01?????? 0:00.01 sshd: mike at pts/0 (sshd) root???? 12461?? 0.0? 0.1? 12868? 2364? 1? R+?? 13:02 0:00.00 grep ssh In the above case, I think you want to kill 12441 and its child 12443. I just tested on a new login via the windows ssh client, and it indeed killed the connection when I killed the two processes on the server ?kill 12532 12534 0(testgateway)# Connection to 192.168.243.5 closed by remote host. Connection to 192.168.243.5 closed. C:\Users\mike> ??? ---Mike