[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: adduser

Oleg Verych wrote:
> Ids may change and i will end up with /var/spool/exim4 owned by
> different user in case /etc/passwd is new.

I don't think that should be a concern because if the ownership of
/var/spool/exim4 needs to be non-root then it should be set in the
postinst script.  That would be true upon the first installation too,
right?  Upon a removal, id scramble, installation the postinst script
will set the correct permissions, right?

Example from the postfix postinst script:

    mkdir -p $MAILDROP
    if ! chown postfix:postdrop $MAILDROP 2>/dev/null; then
        addgroup --system postdrop
        chown postfix:postdrop $MAILDROP

Example from the bind9 postinst script:

    getent group bind >/dev/null 2>&1 || addgroup --system bind
    getent passwd bind >/dev/null 2>&1 ||
        adduser --system --home /var/cache/bind --no-create-home \
                --disabled-password --ingroup bind bind

Example from openssh-server postinst script:

        if ! getent passwd sshd >/dev/null; then
                adduser --quiet --system --no-create-home --home /var/run/sshd --shell /usr/sbin/nologin sshd

Expert help for questions about Debian packaging is available on
debian-mentors mailing list.  It is where I would go for answers to my
packaging questions.

> If i have /etc/passwd set up, i don't want to install adduser. If there
> will be setup option or prompt: "Do you want to add Debian-exim4 (with
> random UID)?" I want to say no. I don't want global ID. I want not
> random one.

Debconf should be available for those types of questions of the user
at installation time.  However if the user selects a non-dynamic id I
don't know how the package could know what global one to use other
than to coordinate it.  Asking the admin installing the package for an
id seems like a big step backward.

Also, packages shouldn't call adduser if the user already exists.


Reply to: