You are not logged in.

#1 2011-02-02 16:07:54

rezza
Member
From: Edinburgh, uk
Registered: 2004-07-08
Posts: 237

[solved] sshd not disconnecting clients on close

When I shut down my sshd, either restarting the machine or manually, currently connected clients are not disconnected. Their ssh sessions just hang, and the terminal has to be closed. How can I make "/etc/rc.d/sshd stop" actually boot clients off?

Last edited by rezza (2011-02-08 14:45:13)

Offline

#2 2011-02-02 16:53:17

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved] sshd not disconnecting clients on close


ᶘ ᵒᴥᵒᶅ

Offline

#3 2011-02-02 22:49:45

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Re: [solved] sshd not disconnecting clients on close

Their ssh sessions just hang, and the terminal has to be closed.

You don't have to close the terminal. The OpenSSH client (i.e. ssh) supports 'escape sequences', and you can force the disconnect between the client and the server by pressing '~' and then '.'. That said, you must have entered a newline just before, so the sequence if often '<enter>', '~', '.'.

If you want more info about this, look at the 'ESCAPE CHARACTERS' sections of the ssh man page.

Offline

#4 2011-02-05 23:16:16

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: [solved] sshd not disconnecting clients on close

Add to /etc/rc.d/sshd inside 'stop)' case:

for i in `/bin/netstat -lantp | /bin/grep -e ' \+[0-9]\+/sshd:' | sed 's|.* \+\([0-9]\+\)/sshd[:] .*|\1|g' | /usr/bin/sort -u`; do /bin/kill -s HUP $i; done

HUP sends a "hang up" signal to client.  For best results use '/bin/kill' (vs 'kill' as it belongs to bash).

Last edited by soloport (2011-02-05 23:27:45)

Offline

#5 2011-02-08 10:03:59

rezza
Member
From: Edinburgh, uk
Registered: 2004-07-08
Posts: 237

Re: [solved] sshd not disconnecting clients on close

Thanks soloport, that was what I was after.

Offline

#6 2011-02-08 10:47:14

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved] sshd not disconnecting clients on close

Please mark your topic solved rezza.


ᶘ ᵒᴥᵒᶅ

Offline

Board footer

Powered by FluxBB