Red Hat Bugzilla – Bug 493641
useradd can't distinguish between groupname and groupid when the groupname is a number
Last modified: 2009-05-18 06:11:14 EDT
Description of problem:
For the sake of sanity in our environment (I work in the phone business) I have to create usernames and groups that are numbers (phone numbers).
useradd can't distinguish between a groupname and a groupnumber even if the group name starts with a number. There is no option do this.
Steps to Reproduce:
1. useradd -s /sbin/nologin 0555555
2. useradd -s /sbin/nologin -d /home/0555555 -g 0555555 0555555-2
useradd: unknown group 0555555
Step 1 creates the user and the group 0555555 but step 2 can't breaks up.
I tried using simple and double quotes (', "), but it just doesn't work
There should be an additional option to handle this case and / or at least explicit documentation.
I know that the idea of usernames and groupnames is not to have to learn the numbers and make it easier, but their should be a work around
Created attachment 344408 [details]
useradd -g look for a group name and then for group number
I'm sorry but I'm afraid I can't fix this issue :( The reason is that I don't want shadow-utils package to diverge from upstream. Shadow-utils upstream does not allow number as a first character of username. This is Fedora/RedHat extension.
I'm sending a patch for shadow-utils-4.1.4(rawhide) that might help you. It's changing the behaviour in a way that useradd -g look for the name at first and if it doesn't find it will look for number.