I wonder if i can disconnect a specific ssh client from ssh server?
Can we do that?
Thanks in advance...
I wonder if i can disconnect a specific ssh client from ssh server?
Can we do that?
Thanks in advance...
This is answered here: https://unix.stackexchange.com/questions/615/how-do-you-kick-a-benign-user-off-your-system/622#622
A copy of the steps:
There's probably an easier way, but I do this:
See who's logged into your machine -- use who
or w
:
> who
mmrozek tty1 Aug 17 10:03
mmrozek pts/3 Aug 17 10:09 (:pts/2:S.0)
Look up the process ID of the shell their TTY is connected to:
> ps t
PID TTY STAT TIME COMMAND
30737 pts/3 Ss 0:00 zsh
Laugh at their impending disconnection (this step is optional, but encouraged)
> echo "HAHAHAHAHAHAHAHA" | write mmrozek pts/3
Kill the corresponding process:
> kill -9 30737
I just discovered you can combine steps 1 and 2 by giving who
the -u
flag; the PID is the number off to the right:
> who -u
mmrozek tty1 Aug 17 10:03 09:01 9250
mmrozek pts/18 Aug 17 10:09 01:46 19467 (:pts/2:S.0)