How to cut off a ssh connection
Ulf Rompe
Ulf.Rompe at icem.com
Thu Jul 19 08:59:25 UTC 2007
Am Mittwoch, den 18.07.2007, 21:57 +0200 schrieb Sergio Belkin:
> Thanks everybody for answer me, but I think that not explained well,
> solutions you suggested me implies kill process sshd, that's the same
> that doing /etc/init.d/ssh stop.
I don't think so. sshd will run an instance of itself for every
connection. This instance is run under the UID and GID of the connected
user.
When using killall, slay or the manual method in the way people
described in their answers, only the instances forked by users are
killed and the connections will be closed. The main sshd will keep
running and accepting connections.
Running "/etc/init.d/sshd stop" achieves exactly the opposite: It stops
the main sshd but leaves established connections intact.
> slay or kill based solutions seems good, although is like
> shot a gun for kill a fly :)
Whatever gets the job done in the most convenient way is the right tool.
Another solution that comes to mind is using pkill to kill all processes
related to a (pseudo) terminal:
Type "who" to get a list of logged in users and the corresponding
terminals. After determining the terminal you want to end (we assume
pts/11 here), use pkill like this:
pkill -t pts/11
[x] ulf
--
Doing a job RIGHT the first time gets the job done. Doing the job WRONG
fourteen times gives you job security.
More information about the ubuntu-users
mailing list