Help - Search - Members - Calendar
Full Version: Kill Shell user
The Planet Forums > Control Panels > cPanel/WHM
Angel78
I have user who was logged since yesterday, he closed SHH, but deamon is still there, how can i Kill him?

Where do i get his pid?
NightHawk
QUOTE
Originally posted by Angel78
I have user who was logged since yesterday, he closed SHH, but deamon is still there, how can i Kill him?

Where do i get his pid?



ok..this is easy....

login to your server, su -

then :
w <--list of who is logged in...with thier pts/# listing
ps aux | grep pts/# (replacing # with his #)
kill -9 pid# of the bash proccess belonging to him.

(just don't kill your own pid...lol)
Angel78
Tnx for help, but it is not working icon_sad.gif

root@main [~]# ps aux | grep pts/1

Gives:

root 13175 0.0 0.0 1404 156 pts/0 R 15:39 0:00 grep pts/1


so PID is 13175


root@main [~]# kill -9 13175
bash: kill: (13175) - No such process

:confused:


also tried :

root@main [~]# kill -9 pid 13175
bash: kill: pid: no such pid
bash: kill: (13175) - No such process
root@main [~]# kill -9 pid13175
bash: kill: pid13175: no such pid


User closed his SSH, but he is still "logged-on"
NightHawk
QUOTE
Originally posted by Angel78
root@main [~]# ps aux | grep pts/1

Gives:

root     13175  0.0  0.0  1404  156 pts/0    R    15:39   0:00 grep pts/1


so PID is 13175


root@main [~]# kill -9 13175
bash: kill: (13175) - No such process

:confused:  


also tried :

root@main [~]# kill -9 pid 13175
bash: kill: pid: no such pid
bash: kill: (13175) - No such process
root@main [~]# kill -9 pid13175
bash: kill: pid13175: no such pid


User closed his SSH, but he is still "logged-on"


that's becuase you skipped a step...

start with :

w

get his pts/# from there, your grep only returned your grep command as the result....so of course the pid didn't exist...(Becuase the grep was done)....let's see...to avoid that ...use this grep command:

ps aux | grep pts/# | grep -v grep (this will make it ignore entries with grep in them)

just don't forget to get his pts/# from the w command first....

for example....

[root@gatekeeper root]# w
07:41:17 up 8 days, 10:31, 2 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 205.231.26.27 7:40am 43.00s 0.01s 0.01s -bash
root pts/1 205.231.26.27 7:41am 0.00s 0.01s 0.01s w

ok...pts/0 is the user we want to kill...so:

[root@gatekeeper root]# ps aux | grep pts/0 | grep -v grep
root 15334 0.0 0.2 4572 1412 pts/0 S 07:40 0:00 -bash
root 15377 0.0 0.1 2652 700 pts/0 R 07:40 0:00 ps aux

then kill -9 15334

Hope that helps
Angel78
I get it I used "who" insetad of "w" but

When i type W i only have root and his pts

When I type WHO then i have root and this second "non-existant" user

icon_smile.gif tnx for help
NightHawk
QUOTE
Originally posted by Angel78
I get it I used "who" insetad of "w" but

When i type W i only have root and his pts

When I type WHO then i have root and this second "non-existant" user

icon_smile.gif tnx for help


ahh...no problem....your bash must be setup differently then mine ..(of course...I was doing that on a plain redhat..not a cpanel box...)

glad it worked out for you.
Jeewhizz
worked fine on my cpanel box icon_smile.gif just how you described icon_smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.