Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2001 09:01:39 +0200
From:      dirk.meyer@dinoex.sub.org (Dirk Meyer)
To:        freebsd-ports@FreeBSD.ORG, ache@nagual.pp.ru
Subject:   Re: HEADS UP: Apache port change from nobody:nogroup to www:www planned
Message-ID:  <4QAWHA6EXO@dmeyer.dinoex.sub.org>
References:  <20011017155854.A43168@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrey A. Chernov wrote:,

> What is the best way to _automatically_ add www:www to
> /etc/{passwd,group}?  I think about 'pw' command, but it will be nice if
> somebody already have working example.

I would suggest:

in Makefile:

pre-install:
        if ! pw groupshow www; then pw groupadd www -g 80; fi
        if ! pw usershow www; then pw useradd www -g www -u 80 \
                -h - -d /nonexistent -s /nonexistent -c "Webserver Daemon"; fi

in pkg-plist:

@exec if ! pw groupshow www 2>/dev/null; then pw groupadd www -g 80; fi
@exec if ! pw usershow www 2>/dev/null; then pw useradd www -g www -u 80 -h - -d /nonexistent -s /nonexistent -c "Webserver Daemon"; fi
@unexec if pw usershow www | grep -q 80:80; then pw userdel www; fi
@comment (removed by userdel) pw groupdel www

Features:
+ No extra scripts.
+ this will preserve existing UID/GID

Drawbacks:
- Must be done and tested in two locations

Suggestions of cause welcome.

kind regards Dirk

- Dirk Meyer, Im Grund 4, 34317 Habichtswald, Germany

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4QAWHA6EXO>