[comp.unix.questions] killing processes

mbader@fred.cs.washington.edu (Mark P. Bader) (05/28/89)

I'm having a problem when I start either a PING or an XTERM process and
put it in the background - I can't kill either of them.  

For example:

hanna% ping blake.acs &
hanna% ps ux
USER       PID %CPU %MEM   SZ  RSS TT STAT  TIME COMMAND
mbader    8794  0.8  2.4  499  305 p2 R     0:34 -csh
mbader    9079  0.8  2.5  506  310 p5 S     0:09 ping blake.acs
hanna% kill -9 9079
9079: Not owner
hanna%

!!!!??? The problem is that I AM the owner!  

The same thing happens when I start an Xterm process - I can't kill it from
the shell that I've started it from (or any other shell for that matter).  I
can only kill it by going into the Xterm window on the display and typing
Control-D.  

Any ideas would be appreciated!

Thanks in advance!

Mark Bader                               INTERNET:  mbader@cac.washington.edu
Networks and Distributed Computing, UW     BITNET:  mbader@uwav1
3737 Brooklyn Ave. NE  	                     BELL:  (206) 543-5128
Seattle, WA  98105                          
	
Mark Bader    { mbader@uwav1   (Bitnet)       }
              { mbader@fred.cs.washington.edu }

jeff@quark.WV.TEK.COM (Jeff Beadles) (05/28/89)

mbader@hanna.cac.washington.edu (Mark P. Bader) writes:
>I'm having a problem when I start either a PING or an XTERM process and
>put it in the background - I can't kill either of them.  

Well, from looking at the the permissions on xterm and ping here:


-rwsr-xr-x  1 root     sys         39936 Apr 12 19:03 /usr/etc/ping
-r-xr-sr-x  1 sys      sys        359424 Apr 14 09:52 /usr/lib/X/bin/xterm

Notice that they are either setuid or setgid.  I would guess that yours are
the same.  Thus, you do not 'own' the process and can not kill it.

As the message says, you either have to be root, or the owner of the process.


	-Jeff
--
Jeff Beadles		Utek Sustaining Engineering, Tektronix Inc.
jeff@quark.WV.TEK.COM

snoopy@sopwith.UUCP (Snoopy) (05/31/89)

In article <3440@orca.WV.TEK.COM> jeff@quark.WV.TEK.COM (Jeff Beadles) writes:

| -rwsr-xr-x  1 root     sys         39936 Apr 12 19:03 /usr/etc/ping
| -r-xr-sr-x  1 sys      sys        359424 Apr 14 09:52 /usr/lib/X/bin/xterm
|
| Notice that they are either setuid or setgid.  I would guess that yours are
| the same.  Thus, you do not 'own' the process and can not kill it.
|
| As the message says, you either have to be root, or the owner of the process.

| Jeff Beadles		Utek Sustaining Engineering, Tektronix Inc.
| jeff@quark.WV.TEK.COM

Correction: setgid processes *can* be killed.  I just tried it, with
identical owner, group, and permissions as listed above, under UTek.
You are still the owner of a setgid process that is not also setuid,
thus you have permission to kill it.
    _____     						  .-----.
   /_____\    Snoopy					./  RIP	 \.
  /_______\   qiclab!sopwith!snoopy			|  	  |
    |___|     parsely!sopwith!snoopy			| tekecs  |
    |___|     sun!nosun!illian!sopwith!snoopy		|_________|

		"I *am* the next man!"  -Indy

shore@mtxinu.COM (Melinda Shore) (06/02/89)

In article <3440@orca.WV.TEK.COM> jeff@quark.WV.TEK.COM (Jeff Beadles) writes:
>
>| -rwsr-xr-x  1 root     sys         39936 Apr 12 19:03 /usr/etc/ping
>| -r-xr-sr-x  1 sys      sys        359424 Apr 14 09:52 /usr/lib/X/bin/xterm

The permissions listed above for xterm are somewhat anomalous;  xterm
is usually setuid root so that it can write on utmp.
-- 
Melinda Shore                                     shore@mtxinu.com
Mt Xinu                                  ..!uunet!mtxinu.com!shore

gwyn@smoke.BRL.MIL (Doug Gwyn) (06/03/89)

In article <869@mtxinu.UUCP> shore@mtxinu.UUCP (Melinda Shore) writes:
>... xterm is usually setuid root so that it can write on utmp.

The following is more a comment for wizards, but:
It really is a shame that a 350Kb program has to be given unlimited access
rights just so it can perform such a simple task.

net@tub.UUCP (Oliver Laumann) (06/04/89)

In article <10356@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes:
> In article <869@mtxinu.UUCP> shore@mtxinu.UUCP (Melinda Shore) writes:
> >... xterm is usually setuid root so that it can write on utmp.
> 
> The following is more a comment for wizards, but:
> It really is a shame that a 350Kb program has to be given unlimited access
> rights just so it can perform such a simple task.

This is not the real reason.  The real reason is that "xterm" must
call chown() on a newly allocate pseudo-tty.  As you certainly know,
under 4.x BSD and "related" systems such as SunOS, only the super-user
may change the owner of a file.

The "shame" actually is that there is no easy and standardized way for
applications like xterm, screen, Suntools, etc. to allocate a pseudo-tty
with the correct owner and to create and remove a corresponding entry in
/etc/utmp.  This should probably be handled by a server process (to make
sure that entries in /etc/utmp are removed on exit).

--
Oliver Laumann              net@TUB.BITNET              net@tub.UUCP