tags 416835 pending thanks Hello,
For your interest, I committed the attached patch. It implements the -n option, and updates the manpage and the comments in /etc/default/useradd So the creation of primary user groups is still the default (but it is documented, and there is a way to disable it). Kind Regards, -- Nekral
Index: debian/patches/series =================================================================== --- debian/patches/series (révision 1177) +++ debian/patches/series (copie de travail) @@ -52,3 +52,4 @@ 505_useradd_recommend_adduser 406_vipw_resume_properly 497_newgrp_primary_group +407_adduser_disable_PUG_with-n Index: debian/patches/407_adduser_disable_PUG_with-n =================================================================== --- debian/patches/407_adduser_disable_PUG_with-n (révision 0) +++ debian/patches/407_adduser_disable_PUG_with-n (révision 0) @@ -0,0 +1,78 @@ +Goal: Document the creation of primary user groups. + Add the -n option to disable this behavior. + +Fixes: #416835 + +Status wrt upstream: not reported yet. + +Notes: + * The nflg variable already existed, but was never set. + + * This could also be done by just specifying that the -g's argument is + optional. As -n is already implemented in RedHat, it may be better + for compatibility to keep it. + + * The debian/useradd.default file had to be updated to reflect these + changes. + +Index: shadow-4.0.18.1/man/useradd.8.xml +=================================================================== +--- shadow-4.0.18.1.orig/man/useradd.8.xml 2007-04-15 16:16:36.000000000 +0200 ++++ shadow-4.0.18.1/man/useradd.8.xml 2007-04-15 16:49:17.000000000 +0200 +@@ -134,8 +134,7 @@ + <para> + The group name or number of the user's initial login group. The + group name must exist. A group number must refer to an already +- existing group. The default group number is 1 or whatever is +- specified in <filename>/etc/default/useradd</filename>. ++ existing group. + </para> + </listitem> + </varlistentry> +@@ -184,6 +183,23 @@ + </varlistentry> + <varlistentry> + <term> ++ <option>-n</option> ++ </term> ++ <listitem> ++ <para> ++ A group having the same name as the user being added to the ++ system will be created by default (when <option>-g</option> is ++ not specified). This option will turn off this behavior. When ++ this option is used, users by default will be placed in ++ whatever group is specified in the ++ <replaceable>GROUP</replaceable> variable of ++ <filename>/etc/default/useradd</filename>. If no default group ++ is defined, group 100 (users) will be used. ++ </para> ++ </listitem> ++ </varlistentry> ++ <varlistentry> ++ <term> + <option>-K</option>, <option>--key</option> + <replaceable>KEY</replaceable>=<replaceable>VALUE</replaceable> + </term> +Index: shadow-4.0.18.1/src/useradd.c +=================================================================== +--- shadow-4.0.18.1.orig/src/useradd.c 2007-04-15 16:15:22.000000000 +0200 ++++ shadow-4.0.18.1/src/useradd.c 2007-04-15 16:16:11.000000000 +0200 +@@ -1036,7 +1036,7 @@ + {NULL, 0, NULL, '\0'} + }; + while ((c = +- getopt_long (argc, argv, "b:c:d:De:f:g:G:k:O:K:mMop:rs:u:", ++ getopt_long (argc, argv, "b:c:d:De:f:g:G:k:O:K:mMnop:rs:u:", + long_options, NULL)) != -1) { + switch (c) { + case 'b': +@@ -1177,6 +1177,9 @@ + case 'm': + mflg++; + break; ++ case 'n': ++ nflg++; ++ break; + case 'o': + oflg++; + break; Index: debian/useradd.default =================================================================== --- debian/useradd.default (révision 1175) +++ debian/useradd.default (copie de travail) @@ -8,12 +8,12 @@ SHELL=/bin/sh # # The default group for users -# 1000=users on Debian systems +# 100=users on Debian systems # same than USERS_GID in adduser -# Please be aware that Debian's adduser defaults to "user groups" -# which means that one group is created for each user -# There is no way to achieve this with useradd which must remains a low -# level utility +# This argument is used when the -n flag is specified. +# The default behavior (when -n and -g are not specified) is to create a +# primary user group with the same name as the user being added to the +# system. # GROUP=100 # # The default home directory. Same than DHOME for adduser Index: debian/changelog =================================================================== --- debian/changelog (révision 1177) +++ debian/changelog (copie de travail) @@ -15,6 +15,8 @@ - passwd: manpages (<=1.15-2), manpages-pl (<= 20020406-1) - login: shadow-login, shadow-passwd, shellutils (<< 2.0-2), manpages-pl (<= 20020406-1) - Remove unneeded Build-Depends: bzip2, file, texinfo, libpam-runtime + - /etc/default/useradd: Mentions the creation of primary user groups is + neither -n nor -g are specified. See also 407_adduser_disable_PUG_with-n * Upstream bugs not yet fixed in upstream releases or CVS: - 493_pwck_no_SHADOWPWD: SHADOWPWD no more exist. pwck do not detect missing users in /etc/shadow. @@ -25,6 +27,8 @@ Thanks to Dean Gaudet for the patch and report. Closes: #414542 - 497_newgrp_primary_group: Do not request a password when a user uses newgrp to switch to her primary group. Closes: #396691 + - 407_adduser_disable_PUG_with-n: Add option -n to useradd to disable the + creation of primary user groups. Closes: #416835 * Upstream bugs fixed in upstream releases or CVS: - 497_non_numerical_identifier moved as 397_non_numerical_identifier because upstream applied it