On Tuesday 18 September 2012 09:24:58 Jan Pohanka wrote:
> Hello,
>
> I can't found proper command to add an existing user to an existing group.
> I have tried following:
>
> user daemon exists as well as group mygroup
>
> # adduser -D -H -G mygroup daemon
> adduser: user 'daemon' in use
>
> Tested on Busybox v1.20.0
>
> regards
> Jan
>
>
Hi,
the command is:
addgroup user group
You need to enable:
config FEATURE_ADDUSER_TO_GROUP
bool "Support for adding users to groups"
default y
depends on ADDGROUP
help
If called with two non-option arguments,
addgroup will add an existing user to an
existing group.
This seems to be somewhat non standard, but at least on debian systems
where addgroup is a link to adduser it works:
addgroup prova
Adding group `prova' (GID 1005) ...
Done.
debian:/home/tito# addgroup tito prova
Adding user `tito' to group `prova' ...
Adding user tito to group prova
Done.
debian:/home/tito# adduser tito prova
The user `tito' is already a member of `prova'.
debian:/home/tito# which adduser
/usr/sbin/adduser
debian:/home/tito# ls -la /usr/sbin/addgroup
lrwxrwxrwx 1 root root 7 Jul 30 2011 /usr/sbin/addgroup -> adduser
debian:/home/tito#
In busybox it was implemented this way because
addgroup has already the needed functions to parse the group files.
Eventually if there is a strong request adduser could be
modified to run:
static void addgroup_wrapper(struct passwd *p, const char *group_name)
when called with 2 non-option arguments as it already does when creating
a new user that needs to be added to an existing group.
Ciao,
Tito
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox