Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] An update to shadow

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Jeremy Blosser <jblosser-smgl AT firinn.org>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] An update to shadow
  • Date: Tue, 6 Mar 2007 08:59:29 -0600

On Mar 06, Thomas Orgis [thomas-forum AT orgis.org] wrote:
> So we have this adduser script in current spell which has been broken from
> the start:
>
> #!/bin/sh
>
> if [ "$UID" == 0 ]; then
>
> if [ -z "$1" ]; then
> read -p "Username: " NEWSER
> else
> NEWSER=$1
> fi
>
> [ -d /home ] || mkdir /home
> groupadd $NEWSER
> useradd -m $NEWSER -g $NEWSER -s /bin/bash
>
> [ -d /var/spool/mail ] || mkdir -p /var/spool/mail
> touch /var/spool/mail/$NEWSER
> chown $NEWSER:mail /var/spool/mail/$NEWSER
> chmod 0660 /var/spool/mail/$NEWSER
> passwd $NEWSER
>
> echo "default shell for $NEWSER has been set to /bin/bash. Edit /etc/passwd
> to change this"
>
> else
>
> su - -c "PATH=$PATH $0 $1"
>
> fi
>
>
> There are so many things wrong with this... ruskie points out the
> /home/users instead of /home ... there's the /var/spool/mail stuff, which
> is infact already handled by useradd.

/home/users is a change by upstream to /etc/default/useradd, it has nothing
to do with this script.

> My problem with this script is: Why is it there at all? What is the added
> value to useradd? It is a freaking box of explosives doing unasked and
> unannounced (help message, query) stuff.

I really don't follow this statement. People are free to use basic useradd
or this script if they want some extra things (home directory created,
shell set to bash, per-user groups). I use it all the time and it works
fine. At worst it needs a man page.

> Plain useradd is a lot nicer, for example it allows me to get some usage
> info via -h or manpage.
> I can set options. Instead of supplying this retarded (no offence, just
> my opinion;-) script we should care to make the system defaults of
> useradd match a default smgl setup (/home/$USER as home dir, for
> example).

No, we shouldn't touch useradd's defaults, that's not our job. We should
probably add a query to shadow that asks what to use for HOME, defaulting
to whatever the current system is using if it is set, else /home/users
since that's what upstream has.

I fail to see how our adduser does any harm. Yes, we should prompt them
before we install it, but it's a reasonable way to wrap up adduser plus
some other useful things for user creation, without messing with the
default behavior of the installed upstream command. If people want it from
us.

> So, my question of the moment is if this is a gating issue.
> Shadow's search column on the stable-rc wiki is marked off and there is
> no bug mentioned ... should we change this?

I see no reason for it to be gating. There's nothing there that breaks
anything that I know of, and it's certainly nothing that's changed in this
release. The adduser HOME issue should get fixed soon but it's been there
a while already and is easy to workaround.

Attachment: pgpU0XdXunsh1.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page