LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (https://www.linuxquestions.org/questions/aix-43/)
-   -   Probably simple.. but... what's the command for... (https://www.linuxquestions.org/questions/aix-43/probably-simple-but-whats-the-command-for-291027/)

NOTORIOUS VR 02-16-2005 12:48 PM

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!

abyss 02-16-2005 12:56 PM

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.

NOTORIOUS VR 02-16-2005 12:59 PM

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

NOTORIOUS VR 02-16-2005 01:00 PM

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

abyss 02-16-2005 01:05 PM

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

zorba4 02-18-2005 08:16 AM

"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.

Mark Taylor 02-21-2005 03:26 AM

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

zorba4 03-09-2005 03:44 PM

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

kakos 06-01-2005 02:51 PM

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

zorba4 06-01-2005 03:06 PM

Quote:

Originally posted by kakos
"no such process".
What does "ps -aef |grep the_pid_number " say ?

kapsis21 08-29-2005 11:02 AM

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.