Path: utzoo!attcan!uunet!vsi!friedl From: friedl@vsi.UUCP (Stephen J. Friedl) Newsgroups: comp.unix.questions Subject: Re: C - development under UNIX - XENIX Summary: Almost Message-ID: <666@vsi.UUCP> Date: 16 May 88 14:49:57 GMT References: <14827@jplgodo.UUCP> <7774@ncoast.UUCP> Distribution: na Organization: V-Systems, Inc. -- Santa Ana, CA Lines: 22 In article <7774@ncoast.UUCP>, allbery@ncoast.UUCP (Brandon S. Allbery) writes: < As quoted from <14827@jplgodo.UUCP> by deutsch@jplgodo.UUCP (Michael Deutsch ): < +--------------- < | 2. A programm running with "setuid" privilege, i.e.: -rwsr-xr-x < | tries to create directory and fails when executed by non-root, < | however, it works when executed by root, why??? < +--------------- < < Since /bin/mkdir is setuid, it runs as root/ORIGINAL USER. The setuid on < mkdir overrides the setuid on the calling program. Thus, the ORIGINAL user < must have permission to create the directory. The mkdir() system call doesn't < have this problem. A brief note here: mkdir does not always work properly if called from a setgid program. If the real user+group does *not* have permission to see the file but the effective group *does*, mkdir permission is denied. This is because mkdir(1) does not reset the effective group to real group before the access(2) call. As indicated, mkdir(2) should work OK. -- Steve Friedl V-Systems, Inc. (714) 545-6442 3B2-kind-of-guy friedl@vsi.com {backbones}!vsi.com!friedl attmail!vsi!friedl