From Bugzilla Helper: User-Agent: Mozilla/5.0 Galeon/1.2.6 (X11; Linux i686; U;) Gecko/20020916 Description of problem: Useradd will not add a user to the system when using the -n flag if a group named after the user exists in /etc/group. On line 1817 of useradd.c, useradd performs a check to see if there is a group which corresponds to the username specified and exits if there is one. In the case where there is a group named after the user, -n is specified, and the default group (in /etc/default/useradd) is something else (say, groupid 100), useradd will not add the user and exits with the error: useradd: group <whatever> exists - if you want to add this user to that group, use -g. Since we're using the -n flag, this shouldn't be relevant. This upsets some automated scripts, which are expecting the documented behaviour. Version-Release number of selected component (if applicable): shadow-utils-4.0.3-6 How reproducible: Always Steps to Reproduce: 1. Add a group named 'foobar' (with gid=200 for example) 2. Add the line 'GROUP=80' to /etc/default/useradd (add a gid of 80 if there isn't one) 3. Try to add a user with the default gid of 80 to the system: useradd -n foobar Actual Results: Got the error message: useradd: group foobar exists - if you want to add this user to that group, use -g. Expected Results: User should have been added with default group 80. Additional info: This error was not present in 7.3 (shadow-utils-20000902-7)
This problem is present in RHEL3 # rpm -q shadow-utils shadow-utils-4.0.3-20.05.i386 # groupadd foobar # useradd -n foobar useradd: group foobar exists - if you want to add this user to that group, use -g. # groupdel foobar # user add -n foobar #now it succeeds # groups foobar foobar : users
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. Please See https://access.redhat.com/support/policy/updates/errata/ If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.