Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!uniwa!DIALix!bernie From: bernie@DIALix.oz.au (Bernd Felsche) Newsgroups: comp.unix.questions Subject: Re: passwd access method? Summary: Filesystem lock Message-ID: <557@DIALix.oz.au> Date: 30 Aug 90 06:15:23 GMT Expires: 31 Aug 90 00:00:00 GMT References: <14920004@hpdmd48.boi.hp.com> Reply-To: bernie@DIALix.oz.au (Bernd Felsche) Organization: DIALix Services, Perth Western Australia Lines: 28 In article <14920004@hpdmd48.boi.hp.com> markw@hpdmd48.boi.hp.com (Mark Wolfe) writes: > [intro deleted]> > My question is this: > Is there a proper way to access the passwd file to insure file inegrity and >security? I use the lockf call to reduce the chance of simultaneous access doing >some unknown damage to the file. Is this sufficient, or are there other checks >I should be making to insure multiple accesses leave the file in a good state? Historically speaking, the standard used to be to mkdir /etc/ptmp before editing /etc/passwd, and the do an rmdir /etc/ptmp after writing out mod's. This works for all users because even root can't mknod a special file if it already exists. The other advantage is that the existence of /etc/ptmp can be checked in shell scripts, whereas file locks are more difficult to identify. > > I guess I'm trying to find out if there is some standard (even defacto >standard) method of accessing the password file, or does everyone that does >this invent their own method. > As far as I know, this is the standard method, but I'm not sure too many people know about it. bernie