On 12/27/06, Uwe Dippel <[EMAIL PROTECTED]> wrote:
you put your test1 into an existing group; in your case staff,wheel; in
the example guest,staff,beer. It does work here, if I put nobody. But I
don't want nobody; since after some hundred it will complain of being too
long, and I did the whole thing ('nobody') originally only, to get it
working. In your case, I'd like
> $ sudo adduser -batch test1 test1 'Test User 1' \
> '$2a$06$kaLk/lPsfDpSibjO4frBf.WyoWOGY98illmMOL/bo6QsPTBmovsoC'
, if you understand what I mean. That is: test1 into its own group and
only into its own group. And I read man adduser surely 30 times up and
down; this is why I tried all those -group veriations, of which none
worked here (see original thread).

I take the example for more clarity:
adduser -batch falken nobody 'Prof. Falken' joshua
(is okay, like in man adduser)
adduser -batch falken falken 'Prof. Falken' joshua
Group ``falken'' does not exist

All right, I missed that subtlety. I can confirm the same behavior.

# adduser -batch falken falken 'Prof. Falken' joshua
Group ``falken'' does not exist

But, adduser(8) states:

-group login_group
    Specify the default login group.  A value of USER means that the
    username is to be used as the login group.

So, this suggests that the -group option sets the _default_ login
group - I don't take that as meaning "a group setting for that
instance of creating a new user." I don't know (and perhaps I'm way
off here) if this means that -group can even be used with -batch.

At any rate, using them together fails for me:

# adduser -group USER -batch falken 'Prof. Falken' joshua
Group ``Prof.'' does not exist
Group ``Falken'' does not exist

adduser(8) also says that -group is for setting the default login
group, and that it does. If set to 'USER' it serves to put the new
user in a group that matches their user name if invoked as follows:

# adduser -batch falken
Added user ``falken''
# grep falken /etc/{passwd,group}
/etc/passwd:falken:*:1002:998::/home/falken:/bin/ksh
/etc/group:falken:*:998:

...but tagging the full name and password information onto the above
command fails all the same. Maybe someone else can confirm if it is
possible to use adduser in batch mode to add a user to non-existent
groups somehow, whether or not the -group option is what it takes.

That said, useradd(8) does much of what you want, and allows the
specifying of a (new, too) primary group with '-g=uid'. It is of
course very similar to adduser(8) in batch mode.

DS

Reply via email to