Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2019 13:46:17 +0200
From:      Per Hedeland <per@hedeland.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: master.passwd out of sync
Message-ID:  <c1e03141-aaf0-cafc-0d24-669ee011e314@hedeland.org>
In-Reply-To: <152896fe-e1fa-6c4d-b1e4-97d13ea13539@gmail.com>
References:  <20190903085614.GD3644@io.chezmoi.fr> <152896fe-e1fa-6c4d-b1e4-97d13ea13539@gmail.com>

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

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...

--Per

> Remember to set your EDITOR so vipw can use your preferred one.
> 
>> Regards
>>
>> -- 
>> Albert SHIH
>> Observatoire de Paris
>> xmpp: jas@obspm.fr
>> Heure local/Local time:
>> Tue 03 Sep 2019 10:51:35 AM CEST
>> _______________________________________________
>> freebsd-questions@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
>> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>>
> 
> 
> Regards,
> Mark
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c1e03141-aaf0-cafc-0d24-669ee011e314>