Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: bnr-fos!leibniz!hwt@watmath.waterloo.edu (Henry Troup) Newsgroups: comp.sys.sun Subject: writing daemons under SunOS 4.0? Keywords: SunOS Message-ID: <359@bnr-fos.UUCP> Date: 4 Apr 89 02:01:45 GMT Sender: usenet@rice.edu Organization: Bell-Northern Research, Ottawa, Canada Lines: 15 Approved: Sun-Spots@rice.edu Original-Date: 21 Mar 89 20:45:04 GMT X-Sun-Spots-Digest: Volume 7, Issue 221, message 8 of 12 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 ]]