pw add user slow

Steve O'Hara-Smith steve at
Tue Oct 18 06:44:23 UTC 2016

On Mon, 17 Oct 2016 23:36:33 +0100
Paul Macdonald <paul at> 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.

Steve O'Hara-Smith <steve at>

More information about the freebsd-questions mailing list