Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 exptools 1/6/84; site ihu1h.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!ihu1h!steffen From: steffen@ihu1h.UUCP (Joe Steffen) Newsgroups: net.unix-wizards Subject: updating an executing setid file when not root Message-ID: <286@ihu1h.UUCP> Date: Thu, 9-Aug-84 09:57:41 EDT Article-I.D.: ihu1h.286 Posted: Thu Aug 9 09:57:41 1984 Date-Received: Fri, 10-Aug-84 01:11:03 EDT Organization: AT&T Bell Labs, Naperville, IL Lines: 29 I'm porting a System V program to BSD 4.2 and ran into this problem. How do you create a file with the setid bits set from a program that is setid to a login other than root? In System III and V this will do it: fd = open(target, O_WRONLY | O_CREAT | O_EXCL, 06711); BSD does not have this form of open, so I tried: fd = creat(target, 06711); but the setid bits were ignored. I added chmod(target, 06711); but the setid bits were still ignored. This program is executed by a command set with a file over a network. The program verifies a passwd in the command, and the replaces a file in the setid login with the file received from the network. Since the file may be executing, it is linked to a temp name, the real name is unlinked, and a new file is created with the real name and the old permissions. Since this program needs to update itself occasionally, it needs to set the setid bits in the created file. -- Joe Steffen, AT&T Bell Labs, Naperville, IL, (312) 979-5381