Force / Kill Logout a User
You terminate a session by killing its parent process, called the session leader. Find out which process it is with:
You terminate a session by killing its parent process, called the session leader. Find out which process it is with:
# ps -dN|grep pts/3
And then kill that process using
# kill -9 <processid>
Kill and Logout a User
# skill -KILL -u vivek
How to kill the tty in unix
This is the result of the finger
command (Today(Monday) when I (Vidya) logged in)
sekic1083 [6:14am] [/home/vidya] -> finger
Name Tty Idle Login Time Where
Felix pts/0 - Thu 10:06 sekic2594.rnd.ki.sw.
john pts/1 2d Fri 15:43
john *pts/2 2d Fri 15:43
john *pts/3 4 Fri 15:44
john *pts/7 - Thu 16:25
Vidya pts/0 - Mon 06:14
Vidya *pts/5 - Mon 06:14
Vidya *pts/6 - Tue 10:13
Vidya *pts/9 - Wed 05:39
Vidya *pts/10 - Wed 10:23
Under column the Tty pts/0 and pts/5
are the current active terminals.
Apart from those two pts/6
, pts/9
and pts/10
are also present and I had logged into these last week. But the idle time for them is showing as "-" (not idle).
How can I kill these 6,9 and 10 terminals?
You can run:
ps -ft pts/6 -t pts/9 -t pts/10
This would produce an output similar to:
UID PID PPID C STIME TTY TIME CMD
Vidya 772 2701 0 15:26 pts/6 00:00:00 bash
Vidya 773 2701 0 16:26 pts/9 00:00:00 bash
Vidya 774 2701 0 17:26 pts/10 00:00:00 bash
Grab the PID
from the result.
Use the PIDs to kill the processes:
kill <PID1> <PID2> <PID3> ...
For the above example:
kill 772 773 774
If the process doesn't gracefully terminate, just as a last option you can forcefully kill by sending a SIGKILL
kill -9 <PID>
how to "kick" a shell userlogin as root and execute "ps -aux" you will see the old SSH session in the process list.
You should see something like this:
Code:
root 2481 0.0 1.0 14452 2040 ? Ss 12:52 0:00 sshd: root@pts/1
root 2484 0.0 0.8 2980 1624 pts/1 Ss 12:52 0:00 -bash
The first line is for a user logged in as root over SSH, the second one is working directly on the system.
To kill the first process run
Code:
kill -9 2481
to kill the second:
Code:
kill -9 2484
No comments:
Post a Comment