[comp.sys.sun] writing daemons under SunOS 4.0?

hwt@watmath.waterloo.edu (Henry Troup) (04/04/89)

I'm writing a daemon process under SunOS 4.0.  I've made the program
setuid root, it immediately forks, and gets rid of its controlling
terminal.  But I can still kill the process from the general user I
started it from.  Is this the correct behaviour?

utgpu!bnr-vpa!bnr-fos!hwt%bnr-public
hwt@bnr (BITNET/NETNORTH)
(613) 765-2337 (Voice)

[[ Making a program setuid only changes the "effective" uid, leaving the
"real" uid the same.  This used to be sufficient to prevent kill from
killing it, but apparently not anymore.  I wonder if that's a bug or more
SVID compliance?  Have the program use "setreuid(0,0)" to set both the
real and effective uid to root.  See the manual page setreuid(2) for more
details.  --wnl ]]