master.passwd out of sync
per at hedeland.org
Tue Sep 3 11:46:24 UTC 2019
On 2019-09-03 12:01, MJ wrote:
> Hi Albert,
> On 3/09/2019 6:56 pm, Albert Shih wrote:
>> Hi everyone,
>> I try to understand how the /etc/pwd.db and /etc/spwd.db are updated with /usr/sbin/pwd_mkdb.
>> Anyone known what going to update those file ?
>> The reason is I try to create a account with pw and sometime I got the
>> pw: user '*******' disappeared during update
>> so I just need to do a
>> /usr/sbin/pwd_mkdb -p /etc/master.passwd
>> and everything work fine.
>> But that's not seem to be normal. So I try to find if they are some cron to
>> do that and didn't find anything.
> If I'm understanding you correctly, you want to know what rebuilds the master.passwd under "normal" circumstances?
> That would be vipw(8).
> Of course, you can still do as you state here and run pwd_mkdb(8) but better to use the right tool for the job.
Well, the "new" pw(8) that Albert uses is just as much "the right
tool" as the traditional vipw(8), and arguably more "user friendly".
With vipw(8) you obviously update /etc/master.passwd yourself, while
pw(8) does that for you - and both of them update /etc/passwd and the
databases /etc/spwd.db and /etc/pwd.db, from /etc/master.passwd,
ultimately using pwd_mkdb(8).
The other difference is that vipw(8) completely re-generates
/etc/passwd and the databases, while pw(8) updates only the specific
user entry (the -u option is passed to pwd_mkdb(8)). Apparently it's
this single user entry update that is failing - or at least the
getpwnam() check for the added user that pw(8) does fails - vipw(8)
(or pwdb(8) without -u) doesn't do any such check, since they update
Anyway Albert, you obviously "shouldn't" get that error message from
pw(8), and you "shouldn't" need to run pwd_mkdb(8) yourself after
using pw(8). Are you running NIS? And if so, do you use the -Y option
to pw(8)? Since you say that you only get the problem "sometimes", one
*guess* is that NIS may not be updated (yet) at the point when pw(8)
does the getpwnam() check. *If* that is the case, running pwd_mkdb(8)
surely won't help - but the passing of time may fix it...
> Remember to set your EDITOR so vipw can use your preferred one.
>> Albert SHIH
>> Observatoire de Paris
>> xmpp: jas at obspm.fr
>> Heure local/Local time:
>> Tue 03 Sep 2019 10:51:35 AM CEST
>> freebsd-questions at freebsd.org mailing list
>> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions