Probably simple.. but... what's the command for...
basically, this is what i'd like to be able to do.
I'l like to be able to logoff or kill remote users... because when I do a w command I get a user (root actually) with a strange number for where the IP usually resides. Here is a cut and paste of this user: root pts/4 Feb 16 10:25 (:0.0) now i'd like to be able to kill this user... I've searched the net for a command to do this but came up empty handed.. i'm sure it's fairly simple, but i can't find out anything that will help me @ this point. Thanks! |
Notorious,
You want to look for the process ID and kill it. ps -ef|grep root or better yet ps -fu root will give you lots of output, but one of the lines in particular might look something like this: root 688302 630990 0 13:50:28 - 0:00 sshd: root@pts/4 Type: kill -9 688302 (this is the process ID) That will do the trick. |
never mind... i found it out... lol... ps -ft pts/4 to find out the PID to kill
then i did a kill -9 PID and it worked perfect... someone walked me though it a few days ago.. not for the same thing.. but i couldn't remember... and i just started to try and I guess my memory is better then I thought :D |
thanks for the info abyss.. I got it anyways.. but u'r method is a little different... i will try it next time..
nix just has so many switches for certain commands, it becomes confusing sometimes... Thank you again! Regards, Sascha |
Sascha,
You're welcome. Looks like your method gives you the PID of the shell in question whereas mine gives you the PID of the remote conntection (e.g., SSHD) process. Killing either will obviously end the session. Interesting. I learned something too! :-) abyss |
"who -u" tells you who is connected, from where, and the PID of his main shell. You just "kill -9" on that PID and finished.
|
kill -9 ? .... why don't you use kill -15 first to see if you can clean up your child procs. The -9 signal cannot be caught by a sig handler and therefore orphans child procs that could be doing any nunber of things. At least if you kill -15 and it works you get a clean up. kill -15 should work in most cases.
Rgds Mark Taylor |
You're right, Mark.
Moreover, if Notorious Vr wants to automate the things in a script, he could kill -15 $PID ; sleep 12; kill -9 $PID # kill -9 just in case kill -15 did not work |
Hi, I use FC2, I was able to find the PID for a user that is on pts/1 using who -u,
but kill -15 gives "no such process". The user appears to be logged on for many days. Any ideas? Thanks |
Quote:
|
i am also having the same problem..
i tried to kill with -9 but still the user shows still logged on xxxxx@uerese:/# ps -aef |grep 442512 yyyyy 442512 9486580 0 09:20:52 pts/1 0:00 login -h 157.77.000.000 -p xxxxx 3199042 8740884 0 10:56:50 pts/2 0:00 grep 442512 and xxxxxx@uerese:/# ps -ft pts/1 UID PID PPID C STIME TTY TIME CMD yyyyy 442512 9486580 0 09:20:52 pts/1 0:00 login -h 157.r77.000.000 -p any suggestions as to what i should be doing the user is trying to logon but is geting stuck at password prompt and when i tried to kill his PID is still shows me the pid when i use who -u command also root@uerese:/# ps -ft pts/1 UID PID PPID C STIME TTY TIME CMD yyyyyy 442512 9486580 0 09:20:52 pts/1 0:00 login -h 157.77.000.000 -p kp |
All times are GMT -5. The time now is 02:44 PM. |