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

[SOLVED] Adding default user to some other groups



Thank you all (and particularly chals) for your suggestions as to how
to add the default user to an additional group. Using 3.0~a42-1, I can
report the following.

Preseeding
----------

Doesn't work. 

Test: in config/preseed/user-groups.preseed.chroot,

	user-setup passwd/user-default-groups string [space-separated groups]

Result: The default user is not added to (at least some) of the groups in
the list.


Live-config boot paramter
-------------------------

Ignored.

Test: auto/config contains the following option (among others)

	 --bootappend-live "locales=en_GB.UTF-8 keyboard-layouts=gb user-default-groups=audio,cdrom,dip,floppy,video,plugdev,netdev,powerdev,scanner,bluetooth,iocard persistent"

Result: user "user" belongs only to group "user".

I examined the script in chroot/lib/live/config/002-user-setup and this seems
to intend to set the environment variable LIVE_USER_DEFAULT_GROUPS if a
boot-time parameter user-default-groups or live-config.user-default-groups
is supplied. Presumably this would become a comma-separated lists of groups,
not a space-separated one as in the preseed method... not sure if that's
significant?


Add own configure script
------------------------

Works!

Noting that 002-user-setup calls /usr/lib/user-setup/user-setup-apply
which in turn adds the user to each group in the result of
db_get passwd/user-default-groups (line 144 et seq.), we can supply a script
which calls add user thus:

8><----
root@ingrid:~/smrg-live/chroot# cat lib/live/config/500-add-user-to-iocard-group 
#!/bin/sh

echo
echo "NB: live-config: adding user to group iocard"
adduser user iocard

8><----

Result: the script "does the right thing", adding user to group iocard
on the first boot. Since I'm using a persistent live-rw, subsequent boots
result in an error message to the effect that user is already a member of
group iocard, but I can cope with that :)

I don't understand why adding a kernel boot parameter specifying
user-default-groups=... fails to work, and I don't think I'm really
competent to go messing around in the live config scripts (esp as I'm
slightly allergic to perl). It does seem that a boot parameter would
be a far better method of doing this though. I also don't understand
why the preseeding fails, nor where the commas separating the group names
get converted to spaces. But the documentation quite consistently
shows commas in some lists and spaces in others, so I suppose that's right.

I should probably improve the script so it doesn't attemtp to add the
user to iocard on every boot, but would actually prefer to get the boot
parameter working and remove the script all toghether.

Hope this helps somebody.

Nick/.


Reply to: