Close all ssh sessions
Hi, How can one force closing an open ssh session ? I want to disconnect a user right after executing a script no waiting for a timeout. Is that possible ? Thanx Miguel Albuquerque Network Administrator CODaLIS SA Chemin de Trèfle-Blanc 18 1228 Plan-Les-Ouates / CH TEL : +41 22 827 30 80 FAX : +41 22 827 30 33 http://www.codalis.ch DISCLAIMER - This message is intended for the use of the named person only. The information contained in this E-mail is confidential and any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited. This message does not represent a formal commitment by Codalis SA. Codalis SA is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.
Hi Miguel,
How can one force closing an open ssh session ? I want to disconnect a user right after executing a script no waiting for a timeout. Is that possible ?
--> have a look at "man sshd" and look for the "command" setting in "~/.ssh/authorized_keys". It allows to restrict a specific RSA/DSA key to only perform a certain command. HTH, Armin -- Am Hasenberg 26 office: Institut für Atmosphärenphysik D-18209 Bad Doberan Schloss-Straße 6 Tel. ++49-(0)38203/42137 D-18225 Kühlungsborn / GERMANY Email: schoech@iap-kborn.de Tel. +49-(0)38293-68-102 WWW: http://armins.cjb.net/ Fax. +49-(0)38293-68-50
How can one force closing an open ssh session ? I want to disconnect a user right after executing a script no waiting for a timeout. Is that possible ?
Thanx
Miguel Albuquerque Network Administrator
CODaLIS SA
I'd suggest something like the following: netstat -anp|awk '/ESTAB/ { split($5,a,":"); if(a[2] = "22" ) then split($7,b,"/"); print b[1];endif; } {next;}' | xargs kill -15 Thanks, Roman.
participants (3)
-
Armin Schoech
-
Miguel ALBUQUERQUE
-
Roman Drahtmueller