Killing the OpenSSH server doesn't cause the Windows OpenSSH client to die

mike tancsa mike at sentex.net
Wed Apr 12 03:09:04 AEST 2023


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



More information about the openssh-unix-dev mailing list