Kill users


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Kill users
# 1  
Old 09-14-2004
Lightbulb Kill users

Someone knows how do I kill a login user only with the login_name?
This moment I kill the user using the following command.
E4500:/mg98/samuel$ whodo samuel
Tue Sep 14 08:32:10 EST 2004
sun

pts/234 samuel 7:30
pts/234 24200 0:00 ksh
pts/234 26724 0:00 whodo

pts/236 samuel 7:31
pts/236 24572 0:00 ksh
pts/236 13874 0:00 ksh
pts/236 10372 0:00 ping
pts/236 7801 0:00 ping
E4500:/mg98/samuel$

When I do "whodo login", it return me only the process PID, and I can kill the process PID, ex: kill -9 24200 26724
This example, I have only six PID. Suppose that I have 50 PID.
There is any command that I can kill the user only using the login name, ex: kill samuel?

Thanx
Samuel
I suppose that I made some mistakes in English...
# 2  
Old 09-14-2004
First, you can become "samuel":
su samuel

Be very sure that this worked:
id

Kill all processes owned by the current user:
/usr/bin/kill -9 -1

A pid of -1 is special, it is a wildcard pid. Some shells have a kill built-in command that doesn't understand this. That's why you might need the real kill command.

However, you should not use kill -9 except as a last resort. A process cannot catch or ignore -9, that's why newbie admins love it. The process almost always dies with a -9. But most processes behave well with signals. Only a few processes are broken. And processes may have allocated resources that they will free upon their death. But that can't happen if they are killed with a -9.

So try a:
/usr/bin/kill -1 -1
first. And wait a few seconds. Anything left was probably nohup'ed. It may be important and you may want to contact the user before proceeding. Then do:
/usr/bin/kill -15 -1
which should kill a nohup'ed process.

If it survives a -15, you will need to try the -9. But that should happen only rarely.
# 3  
Old 09-14-2004
Be sure to be u login as that "user"

Following works for me atleast in AIX.


kill `ps -ef | grep "samuel" | tr -s " " | cut -d" " -f 3`
# 4  
Old 09-15-2004
Thanx

Thanx everybody to help me....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies

2. UNIX for Advanced & Expert Users

How to kill network users?

Hi everybody. I am using SCO open server. My problem is to kill users logged in my local network. I am using Kill -9 command for kill the repective user/terminal. But it shows in 'who -u'. when i try to kill agina that process it shows like "6229: no such process " User count is... (6 Replies)
Discussion started by: sanjaykunjam
6 Replies

3. AIX

command to kill all loged in users

Guy's I'm looking for command to kill all the loged in users in AIX server Is there specific command can help us to kill any loged in users I have this command who -u it'll show me the process ID of all the users but I want command to kill all the users including to root without... (1 Reply)
Discussion started by: Mr.AIX
1 Replies

4. HP-UX

kill idle users

Hi, In my network we uses the NetTerm program to connect us to HP-UX 10.x server from windows workstations, but in some cases the user doesn't logout and close it by window's x button. The problem is that in HP-UX the user and all his tasks remain active and when he enter again HP-UX creates a... (12 Replies)
Discussion started by: efrenba
12 Replies

5. AIX

Script allows user to kill other users: I'd like to know HOW...

Hello list, Have a problem that's highlighting gaps in my knowledge; can you assist? We have a script that's tacked onto our trading application which allows branch managers etc. to kill off the sessions of other users at their branch. A menu option in the application spawns a shell running... (8 Replies)
Discussion started by: alexop
8 Replies

6. Shell Programming and Scripting

kill crashed out users

Hi all, We have a problem where we get a fair few users either exiting incorrectly or crashing. I'm trying to get a script together that runs every hour to kill these processes off. We are running Sco OperServer(TM) Release 5 The command we use to get a list of users who have crashed: ps... (2 Replies)
Discussion started by: tez
2 Replies

7. UNIX for Advanced & Expert Users

When kill doesnt work, how to kill a process ?

Hi All, I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages. How can i terminate this daemon ? ? ? Regards, Vijay Hegde (3 Replies)
Discussion started by: VijayHegde
3 Replies

8. HP-UX

Is there a script available to kill Idle users

My max user parm is set to 1050. I'm currently at 1038 this is causing major slow downs on the server. I looking for a way log off "idle" user logins with out having to do it individually. :confused: (5 Replies)
Discussion started by: rfmurphy_6
5 Replies

9. Shell Programming and Scripting

kill process of other users

Hi, Can I kill process submitted by another uesr (say user1) if I'm not the su. If I got some previledges granted from user1, can I kill user1's process? Please advise? Thank you very much! Regards, Tse (4 Replies)
Discussion started by: tsesukfan
4 Replies

10. Shell Programming and Scripting

Script to kill stranded/orphan process by users.

I have customers on our AIX/UNIX node startup a process that becomes stranded or orphaned and must be killed. I would like to create a script to check for these orphan processes and kill them. I can have cron run this job. The customers process will run and after 24 hours time out leaving an... (4 Replies)
Discussion started by: rjohnson
4 Replies
Login or Register to Ask a Question