[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: repeated system mail, /etc/.pwd.lock ?



On Wed 05 May 2021 at 12:01:07 (-0400), Greg Wooledge wrote:
> On Wed, May 05, 2021 at 10:36:53AM -0500, David Wright wrote:
> > OTOH perhaps monkeysphere has some reason to lock /etc/passwd et al
> > during operation. Running strings on its binaries might throw up
> > some 'pwd.lock' matches. Or one could inotifywatch the program to
> > see how often it is run (unless it's a daemon). Just thinking aloud.
> 
> I actually looked for that filename in "strings /usr/bin/sudo" and
> "strings /usr/sbin/vipw" before Google told me that it's used by those
> libc functions (lckpwdf(3) and its buddy ulckpwdf(3)).
> 
> It's a bit odd that the man page doesn't contain the filename.  Usually
> you'd expect it to.
> 
> > One thing I didn't learn is why .pwd.lock is in /etc/ rather than,
> > say, /run/lock/. Perhaps related, why are there dotfiles in /etc/
> > anyway. (.git/, .java/, .etckeeper, .gitignore are the others.)
> > What are they hiding from?
> 
> This predates /run by a long time.
> 
> Also, presumably, it wants to be in /etc because that's where the file
> that it's paired with lives.  Dot-lock files are usually in the same
> location as the files they represent.

Yes—though its name, in fact, ensures that it never lists next to any
of the files that it might be assumed to lock.

> Why the dot?  So that it doesn't show up in a casual "ls" and cause a
> bunch of n00b questions, obviously.

Yes, I can understand that for the users' home directories; they don't
want listings of their own files to be interspersed with configuration
files. And many of the latter files will be read and written on behalf
of the user rather than by themselves, so there's little need for them
to see them all the time.

But /etc isn't anybody's home directory: it's configuration information
for the whole system. So there's no need to dot any of the files and
directories in order to either inform the sysadmin that these are
configuration files, or to hide them. Anyway, that was my (related) point.

Cheers,
David.


Reply to: