Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jun 1998 23:01:22 -0700 (PDT)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        "Brian O'Connor" <boc@ironbark.bendigo.latrobe.edu.au>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: what happens to daemon processes when password file is zeroed
Message-ID:  <Pine.BSF.3.96.980604230006.26356I-100000@gdi.uoregon.edu>
In-Reply-To: <199806050427.OAA05884@ironbark.bendigo.latrobe.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980604230006.26356I-100000>