Creation of users in ports

Chris Rees utisoft at
Wed Dec 7 20:10:13 UTC 2011

On 7 December 2011 20:06, Brooks Davis <brooks at> wrote:
> On Wed, Dec 07, 2011 at 07:54:07PM +0000, Chris Rees wrote:
>> Hi all,
>> I'm at a loss as to how to restore functionality for creating (or
>> using) customised users in ports.  For example, using the old method
>> (pkg-install scripts) many ports allowed the user to change the
>> username used for the port.
>> With the new functionality, if the username isn't found in
>> /usr/ports/UIDs it's rejected, and the port can't use it.
>> Can anyone explain to me why it would be a bad idea to include the
>> system's passwd and group files in the search? This would allow the
>> ports system to accept any user that already exists, as well as
>> creating the correct code in the plist.
>> For example; someone wants to install postgresql as username Fred, so
>> s/he sets PG_USER=Fred in /etc/make.conf.  Currently this causes an
>> error on build, because Fred is not in /usr/ports/UIDs.  Were
>> /etc/master.passwd and /etc/group searched too, that wouldn't cause a
>> problem.
>> Any obvious oversights?
> It seems like a better (but more complicatd) solution would use "getent
> passwd ${USER}" to check for existing users.  (You need to check
> explicitly rather than treating the output without /etc/passwd because
> some nss modules don't enumerate to avoid listing the thousands or tens
> of thousands of users in a corporate AD or LDAP installation).

Oops, there's the obvious problem :) Thanks.

Hm, getent will need some sed magic to change to master.passwd style,
or we could change UIDs to use passwd style....


More information about the freebsd-ports mailing list