Pabbisetty.henr@xerox.com (Nagesh Pabbisetty) (01/27/89)
Hello Wizards, Here is a simple one for you. I am having a problem (explained below) with killing processes using a c-shell script. I need a way that ANY user can kill xnsstart and xnshelper by running the xnskill shellscript. xnsstart and xnshelper are created when I run xnsinit as "root". Could anyone tell me why I am having this problem? How can I remedy this? Thanks for all the help! - nagesh. ----------------------------------------------------------------------------- problem: ------- When I login as an unprevileged/normal user and run "/usr/new/xns/xnskill", I get the following output: 2347: Not owner ----------------------------------------------------------------------------- script file name: xnskill ----------------- cat xnskill: ----------- # c-shell script file to kill xnsstart and xnshelper kill -9 `ps -ax | fgrep xnsstart | fgrep -v fgrep | cut -c1-5` kill -9 `ps -ax | fgrep xnshelper | fgrep -v fgrep | cut -c1-5` ----------------------------------------------------------------------------- pertinent details: ------------------ ps -ax : ------- PID TT STAT TIME COMMAND . . . 2347 p4 I 0:00 /etc/xnsstart le0 2348 p4 I 0:00 /etc/xnshelper default domain Henr801c default organization . . . ps -alx : -------- F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND . . . 8201 0 2347 1 0 15 0 40 120 pause I p4 0:00 /etc/xnsstart 8001 0 2348 1 0 1 0 48 320 select I p4 0:00 /etc/xnshelper . . . ls -l /usr/new/xns: ------------------ -rwsr-sr-x 1 root 44 Jan 25 11:40 xnsinit* -rwsr-sr-x 1 root 173 Jan 26 13:15 xnskill* ----------------------------------------------------------------------------- -----------------------------------------------------------------------------
maart@cs.vu.nl (Maarten Litmaath) (02/01/89)
Pabbisetty.henr@xerox.com (Nagesh Pabbisetty) writes:
\# c-shell script file to kill xnsstart and xnshelper
\kill -9 `ps -ax | fgrep xnsstart | fgrep -v fgrep | cut -c1-5`
\kill -9 `ps -ax | fgrep xnshelper | fgrep -v fgrep | cut -c1-5`
A setuid script must start with the `#!' magic number, as in
#! /bin/csh -bf
There can be 1 argument (in this case `-bf'). However, setuid scripts that
don't invoke `/bin/secure' or `/bin/setuid' as `interpreter' are a security
leak! This topic was discussed a couple of months ago in comp.unix.wizards.
Email for more detail.
Both of the programs mentioned above recently appeared in comp.sources.misc.
If you decide to use `/bin/setuid', be sure you have version 1.1 or higher.
Version 1.0 contained a race condition bug.
--
"Does she play, er, tennis? |Maarten Litmaath @ VU Amsterdam:
Wink wink, notch notch!" |maart@cs.vu.nl, mcvax!botter!maart
krh@root.co.uk (Kevin Hickman) (02/16/89)
In article <18213@adm.BRL.MIL> you write: >I am having a problem (explained below) with killing processes using a >c-shell script. > >kill -9 `ps -ax | fgrep xnsstart | fgrep -v fgrep | cut -c1-5` >kill -9 `ps -ax | fgrep xnshelper | fgrep -v fgrep | cut -c1-5` ^^^^^ You should not be using these particular options as how can you be sure that the login name will start in column 1 and continue for 5 columns? should read: kill -9 `ps -ax | fgrep xnshelper | fgrep -v fgrep | cut -f3 -d" "` As for why you are unable to kill your process, I don't know. *B)>-< Kevin Hickman. -- Kevin Hickman UniSoft Limited, Saunderson House, Hayne Street, London EC1A 9HH krh@root.co.uk ...!mcvax!ukc!root44!krh +44-1-606-7799 FAX: +44-1-726-2750
dupuy@cs.columbia.edu (Alexander Dupuy) (02/25/89)
In article <18213@adm.BRL.MIL> you write: >I am having a problem (explained below) with killing processes using a >c-shell script. > >kill -9 `ps -ax | fgrep xnsstart | fgrep -v fgrep | cut -c1-5` >kill -9 `ps -ax | fgrep xnshelper | fgrep -v fgrep | cut -c1-5` You can also eliminate the extra fgrep with the -c option to ps: kill -9 `ps -acx | fgrep xnsstart | cut ...` @alex -- -- inet: dupuy@cs.columbia.edu uucp: ...!rutgers!cs.columbia.edu!dupuy