pw add user slow

Steve O'Hara-Smith steve at sohara.org
Tue Oct 18 13:32:07 UTC 2016


On Tue, 18 Oct 2016 07:46:13 -0500 (CDT)
"Valeri Galtsev" <galtsev at kicp.uchicago.edu> wrote:

> 
> On Tue, October 18, 2016 1:44 am, Steve O'Hara-Smith wrote:
> > On Mon, 17 Oct 2016 23:36:33 +0100
> > Paul Macdonald <paul at ifdnrg.com> wrote:
> >
> >>
> >> Hi,
> >>
> >> I have to migrate an imap server, which uses about 6000 local accounts
> >> for mail delivery
> >>
> >> I'm using a script that creates system acounts using:
> >>
> >> /usr/sbin/pw adduser $LOCAL_USER -u$UID-gGID-d $PATH -s/bin/false
> >>
> >> I'm finding this grows ever more slow, up to 10 seconds per account on
> >> a SATA box  , and on a test SSD box ( 20 acc's per second initially)
> >> even that slows to about 1 account created per second.
> >>
> >> why does this slow down as more accounts are added?
> >
> > 	Because for each one it updates text files (passwd and
> > master.passwd) and regenerates databases (pwd.db and spwd.db) from the
> > text
> > files. The fastest way to do this sort of thing is to directly update
> > passwd and master.passwd and then run pwd_mkdb.
> 
> It appears to be sufficient to only edit master.passwd; pwd_mkdb will
> re-generate passwd file from master.passwd.

	Quite right - it's been a while since I last did this.

-- 
Steve O'Hara-Smith


More information about the freebsd-questions mailing list