From owner-freebsd-questions@FreeBSD.ORG Sat Jun 12 23:46:16 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B726416A4CE for ; Sat, 12 Jun 2004 23:46:16 +0000 (GMT) Received: from smtp-gw-cl-d.dmv.com (smtp-gw-cl-d.dmv.com [216.240.97.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5EC7E43D55 for ; Sat, 12 Jun 2004 23:46:16 +0000 (GMT) (envelope-from sven@dmv.com) Received: from mail-gw-cl-b.dmv.com (mail-gw-cl-b.dmv.com [216.240.97.39]) i5CNjiRv007846 for ; Sat, 12 Jun 2004 19:45:44 -0400 (EDT) (envelope-from sven@dmv.com) Received: from [192.168.1.2] (dogpound.dyndns.org [64.45.134.154]) by mail-gw-cl-b.dmv.com (8.12.9/8.12.9) with ESMTP id i5CNjhnq046346 for ; Sat, 12 Jun 2004 19:45:44 -0400 (EDT) (envelope-from sven@dmv.com) Message-ID: <40CB95AD.6080108@dmv.com> Date: Sat, 12 Jun 2004 19:45:49 -0400 From: Sven Willenberger User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.39 Subject: Passing pwd_mkdb args to pw command X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jun 2004 23:46:16 -0000 Is there any way to pass an argument to the pw command that could be passed to it when it invokes pwd_mkdb to rebuild the password database. On a system with about 25k users, it takes an inordinate amount of time to rebuild the database using the pw command. Invoking the pwd_mkdb on the master.passwd file using the -s flag (-s 96) speeds up this process immensely (FreeBSD 5.2.1-Release-P8). By "immensely" I mean from nearly 30 seconds to just under 5 seconds. The following scenario is why I ask: Have a perl script that adds a user to the master.passwd file (yeah I know, dangerous, but it's only bit me twice in as many years and could recover with the backup the script makes). Part of the script involves invoking system commands to make the home directory and change permissions on it. Unfortunately, even though testing for the return status, I still find that that often the chown system call fails with "directory not found". It would seem that the mkdir command returns a status of success before the directory tables are actually updated and/or the changes written to disk. (This happens regardless of whether I use the perl builtins or system() calls). So the idea would be to invoke the pw command instead, but having a 30 second rebuild for every user added, deleted, password changed, etc is kind of a show stopper here. Has anyone patched or found a way to make this happen? If not, has anyone done similar to what I am trying to do or found other workarounds? Thanks, Sven