LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 02-16-2005, 12:48 PM   #1
NOTORIOUS VR
Member
 
Registered: Jan 2005
Location: TORONTO, CANADA
Distribution: SuSE 9.2
Posts: 50

Rep: Reputation: 15
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!
 
Old 02-16-2005, 12:56 PM   #2
abyss
Member
 
Registered: May 2001
Location: New York, USA
Distribution: AIX, Ubuntu
Posts: 113

Rep: Reputation: 16
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.
 
Old 02-16-2005, 12:59 PM   #3
NOTORIOUS VR
Member
 
Registered: Jan 2005
Location: TORONTO, CANADA
Distribution: SuSE 9.2
Posts: 50

Original Poster
Rep: Reputation: 15
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
 
Old 02-16-2005, 01:00 PM   #4
NOTORIOUS VR
Member
 
Registered: Jan 2005
Location: TORONTO, CANADA
Distribution: SuSE 9.2
Posts: 50

Original Poster
Rep: Reputation: 15
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
 
Old 02-16-2005, 01:05 PM   #5
abyss
Member
 
Registered: May 2001
Location: New York, USA
Distribution: AIX, Ubuntu
Posts: 113

Rep: Reputation: 16
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
 
Old 02-18-2005, 08:16 AM   #6
zorba4
Member
 
Registered: Feb 2004
Location: Paris
Posts: 398

Rep: Reputation: 31
"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.
 
Old 02-21-2005, 03:26 AM   #7
Mark Taylor
Member
 
Registered: Apr 2004
Posts: 60

Rep: Reputation: 15
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
 
Old 03-09-2005, 03:44 PM   #8
zorba4
Member
 
Registered: Feb 2004
Location: Paris
Posts: 398

Rep: Reputation: 31
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
 
Old 06-01-2005, 02:51 PM   #9
kakos
LQ Newbie
 
Registered: Jun 2005
Posts: 1

Rep: Reputation: 0
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
 
Old 06-01-2005, 03:06 PM   #10
zorba4
Member
 
Registered: Feb 2004
Location: Paris
Posts: 398

Rep: Reputation: 31
Quote:
Originally posted by kakos
"no such process".
What does "ps -aef |grep the_pid_number " say ?
 
Old 08-29-2005, 11:02 AM   #11
kapsis21
LQ Newbie
 
Registered: Aug 2005
Posts: 2

Rep: Reputation: 0
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

Last edited by kapsis21; 08-29-2005 at 11:10 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help with programming a simple ls command in C babyboss Programming 4 10-19-2005 05:01 PM
simple cp command question basher400 Linux - Newbie 7 06-08-2005 08:26 AM
Simple Command Help mhelliwell Linux - Newbie 5 02-13-2005 02:36 AM
Simple Linux command Problem GUIPenguin Linux - Newbie 2 09-23-2004 04:47 PM
need a simple php4 command phek Programming 2 09-25-2001 12:06 PM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 11:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration