passwd access method?
Bernd Felsche
bernie at DIALix.oz.au
Thu Aug 30 16:15:23 AEST 1990
In article <14920004 at hpdmd48.boi.hp.com> markw at 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
More information about the Comp.unix.questions
mailing list