You are not logged in.
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
This might help: http://www.mail-archive.com/linux-users … 54602.html
ᶘ ᵒᴥᵒᶅ
Offline
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
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
Thanks soloport, that was what I was after.
Offline
Please mark your topic solved rezza.
ᶘ ᵒᴥᵒᶅ
Offline