From owner-freebsd-questions Thu Jun 4 23:02:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA11035 for freebsd-questions-outgoing; Thu, 4 Jun 1998 23:02:04 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from gdi.uoregon.edu (gdi.uoregon.edu [128.223.170.30]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA10955 for ; Thu, 4 Jun 1998 23:01:30 -0700 (PDT) (envelope-from dwhite@gdi.uoregon.edu) Received: from localhost (dwhite@localhost) by gdi.uoregon.edu (8.8.8/8.8.8) with SMTP id XAA26973; Thu, 4 Jun 1998 23:01:23 -0700 (PDT) (envelope-from dwhite@gdi.uoregon.edu) Date: Thu, 4 Jun 1998 23:01:22 -0700 (PDT) From: Doug White Reply-To: Doug White To: "Brian O'Connor" cc: freebsd-questions@FreeBSD.ORG Subject: Re: what happens to daemon processes when password file is zeroed In-Reply-To: <199806050427.OAA05884@ironbark.bendigo.latrobe.edu.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 5 Jun 1998, Brian O'Connor wrote: > Hello, > I have an aversion to NIS, and am trying to roll my own with > ssh and other such tools. I have already had the delightfull experience of > deleting the password file(I got my + < and > the wrong way around in perl). > It occured to me that if the password file was deleted, or of zero length > how do running daemons handle permissions? ie, processes seemed to continue > to run, I just couldn't log in. They compare uid's. The system stores user and group perms by ID, not by name. Even though the name->number mapping is gone the numbers are still around. > What I want to try is to write a daemon that checks to see if the passwd > file exists, and is of non zero size(i could put other tests here, but this > will do for a start). If this test fails, it copies a fail safe copy over > and then reports the error, of course this will fail if the daemon does > not have permission to write to /etc (since there is no user root) Yeah there is, UID 0 still exists. Don't try to setuid("root"), but you can do setuid(0). Doug White | University of Oregon Internet: dwhite@resnet.uoregon.edu | Residence Networking Assistant http://gladstone.uoregon.edu/~dwhite | Computer Science Major NOTICE: gdi.uoregon.edu is going down, please use dwhite@resnet! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message