From owner-freebsd-questions@FreeBSD.ORG Thu Dec 13 15:25:10 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD00A16A420 for ; Thu, 13 Dec 2007 15:25:10 +0000 (UTC) (envelope-from jonathan@hst.org.za) Received: from hermes.hst.org.za (onix.hst.org.za [209.203.2.133]) by mx1.freebsd.org (Postfix) with ESMTP id C741D13C458 for ; Thu, 13 Dec 2007 15:25:09 +0000 (UTC) (envelope-from jonathan@hst.org.za) Received: from sysadmin.hst.org.za (sysadmin.int.dbn.hst.org.za [10.1.1.20]) (authenticated bits=0) by hermes.hst.org.za (8.13.8/8.13.8) with ESMTP id lBDEfxMv034856 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 13 Dec 2007 16:41:59 +0200 (SAST) (envelope-from jonathan@hst.org.za) From: Jonathan McKeown Organization: Health Systems Trust To: freebsd-questions@freebsd.org Date: Thu, 13 Dec 2007 16:52:54 +0200 User-Agent: KMail/1.7.2 References: <20071212180452.GP51627@amilo.cenkes.org> In-Reply-To: <20071212180452.GP51627@amilo.cenkes.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200712131652.54824.jonathan@hst.org.za> X-Spam-Score: -4.379 () ALL_TRUSTED,AWL,BAYES_00 X-Scanned-By: MIMEDefang 2.61 on 209.203.2.133 Subject: Re: Where is the next uid from adduser pulled from? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2007 15:25:10 -0000 On Wednesday 12 December 2007 20:04, Andrew Pantyukhin wrote: > On Wed, Dec 12, 2007 at 12:00:06PM -0500, Francisco Reyes wrote: > > I have scripts to add new users. However, after that any port that > > installs a user creates it with a UID after the ones I made. > > > > For example I want all employees to have uids starting at 5000, but I > > would like too port installed uids to be 2000 and up. After I add some > > users (ie say last user is 5008), the next port that installs a user and > > doesn't specify uid.. then will get 5009. > > > > Tried looking for the adduser program, but could not find adduser.c > > It's pw(8) that selects default uids and it just takes the last > one (numerically) and uses the next one. > > Create a placeholder user with uid 5000 and let ports use uids > 5000+, but when creating new users, specify uids manually (both > pw and adduser allow that). Alternatively, create/edit /etc/pw.conf including minuid 2000 maxuid 4999 reuseuids yes This will cause automatic uses of pw(8) (such as port installations) to use uids between 2000 and 4999, and to ``fill in the gaps''. When adding a user by hand, use pw -C /dev/null to tell pw to ignore pw.conf(5) and get the default behaviour (which is to use the uid one higher than the highest ever used). adduser(8) should just DTRT, but you can make sure by adding to the flags -u uid_start which will use the next available uid after uid_start (which it identifies by testing each uid in turn for existence, not by just using pw usernext). Jonathan