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

Thread Tools Search this Thread
Operating Systems AIX Script allows user to kill other users: I'd like to know HOW...
# 1  
Old 07-09-2007
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 this script. As far as I can tell it's spawned in the same context as the user that logged in (no sudo ing or any other type of security context switching - as far as I can see).

The script itself doesn't have any sudo reference in it, nor does it call any other scripts, as far as I can tell.

Some detail on an example run of the script:

The script running, and the effective UID:
$ ps -fp 16974070
kccah 16974070 25407552 0 16:21:08 pts/97 0:00 /bin/ksh /usr/hxscripts/brkill
$ ps -fp 16974070 -o ruser=

Some detail on the user:

$ lsuser kccah
kccah id=2957 pgrp=users groups=users,users,mail home=/usr/home/branch/users/kcc shell=/usr/bin/ksh gecos=Alex_Hawdon roles=

The function in the script that runs the kill, bits that do the killing are highlighted bold:

# To kill a user we have to do the following :
# kill the user is partition (unix nice kill)
# if they are still there, do a nasty kill
# clear the partition table of illegal entries
# if they were logged in from a spider, then kill that spider port
# (( if they were logged in from an annex, then kill that annex port ))
log "Killed a user : User Details"
log "USERID : ${USERID[$1]}"
log "USER NAME : ${USERNAME[$1]}"
log "USER PID : ${USERPID[$1]}"
/usr/bin/kill -15 ${USERPID[$1]} 2>>/dev/null
sleep 1
AIX) COMMAND=`who -u | awk -v pid=${USERPID[$1]} '$7==pid' | wc -l`;;
OSF1) COMMAND=`who -uM | awk -v pid=${USERPID[$1]} '$7==pid' | wc -l`;;
*) echo "Fatal error - unknown UNIX version"

if [ $COMMAND -eq 1 ]
/usr/bin/kill -9 ${USERPID[$1]} 2>>/dev/null
$KCMLADDR/bkstat -C
TERMIDFILE=`echo "$USERHOME" | sed "s/user/termid.csv/"`
# TERMIDFILE=`echo "$USERHOME" | sed "s/users/termid.csv/"`
REMOTE=`awk -v term=${USERTERM[$1]} -F, '$2==term' $TERMIDFILE`
if [ ! "$REMOTE" = "" ]
SPIDER=`echo "$REMOTE" | awk -F, '{print $1}' | cut -c 2-9`
PORT=`echo "$REMOTE" | awk -F, '{print $1}' | cut -c 11-12 | sed "s/^0//"`
rsh -l eod saturn "/usr/users/tech/stu/scripts/SPIDER/linekill.exp $ $PORT" > /dev/null
AIX) COMMAND=`who -u | awk -v pid=${USERPID[$1]} '$7==pid' | wc -l`;;
OSF1) COMMAND=`who -uM | awk -v pid=${USERPID[$1]} '$7==pid' | wc -l`;;
*) echo "Fatal error - unknown UNIX version"
if [ $COMMAND -eq 1 ]
echo "Unable to clear user - Please contact Service Desk"

A copy of the script is attached. A note - the /etc/dirlist script just sets up variables - it doesn't do *anything* fancy at all.

Thanks for your time on this, folks! Sorry if I've hastily overlooked something obvious!

Any further information required - give me a shout.

Thanks and regards,

# 2  
Old 07-09-2007
I don't see a question in your post...?? Are you asking how one user running this script is able to kill other user's sessions? If so, do a "ls -l brkill.txt" and post that. It may have a root sticky bit on it.
# 3  
Old 07-10-2007
kah00na - yes, sorry! You're right through; I'd like to know how the script allows users to kill other users.

Here's the output, I'm afraid it's not that:

-rwxrwxr-- 1 kcckr users 8090 09 Jul 15:40 /usr/hxscripts/brkill

Any other ideas?

Thanks and regards,

# 4  
Old 07-10-2007
Do a ls -l on /usr/bin/kill and post the results of that. The permissions of the kill process are relevant, not the permissions on the shell that invokes it. Most shells have a kill built-in and this script is intentionally avoiding the kill built-in.
# 5  
Old 07-10-2007

Sorry, but I don't think that's it. I did notice it was avoiding the built-in and I had a look at /usr/bin/kill - I should have posted the information but I don't like to bore people with a massive post which no one can be bothered reading...

-r-xr-xr-x 1 bin bin 7222 13 May 2004 /usr/bin/kill
# 6  
Old 07-10-2007
Also -
$ file /usr/bin/kill
/usr/bin/kill: executable (RISC System/6000) or object module

so it's not a wrapper script that's doing any sudoing or suchlike...
# 7  
Old 07-10-2007
What OS? Do a uname -a.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to ignore the user from list of users

Hi, I have a situation where I want to ignore few users from list of users and print rest of user in log file. say, I want to ignore aaa, bbb, ccc, ddd .. ppp from list of 20 user (do not want to include) What is the good command or any script? Thanks in advance. (1 Reply)
Discussion started by: sumit30
1 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. Shell Programming and Scripting

Help with script to stop a user giving kill command on a server!!

Hi, I am new to shell scripting and want to create a script with the follwoing description: I want to restrict the users from giving a kill command on a unix server. The server have a restricted logins with login id and passwords. I want a script that will find out if a user has given a... (9 Replies)
Discussion started by: shell_scripting
9 Replies

4. UNIX for Dummies Questions & Answers

crontab or looping script to Kill process from user

I am looking for a way to kill 2 processes from a user through some kind of script. Using an oracle script, I get two process ids that need to be killed. SQL> select ssn.process as client_process_id, pcs.spid as oracle_process_id, ssn.sid, ssn.serial# 2 from v$session ssn inner join... (5 Replies)
Discussion started by: Meert
5 Replies

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

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

8. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: samuel
3 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

Featured Tech Videos