I'm an amateur Kubuntu user, and have much to learn.

I am trying to create a user account which are named after numbers. I have sudo privileges and I tried it on the root account as well.

Apparently, to add such an account, you have to use the command:

sudo adduser --force-badname

and then the number.

I tried this, and it worked for 10 accounts. During the eleventh, it failed and gave me an error message:

$ sudo adduser --force-badname 11
Allowing use of questionable username.
Adding user `11' ...
Adding new group `11' (1010) ...
Adding new user `11' (1010) with group `11' ...
useradd: group '11' does not exist
adduser: `/usr/sbin/useradd -d /home/11 -g 11 -s /bin/bash -u 1010 11' 
returned error code 6. Exiting.

Eventually, I changed my command to useradd to add the account, and it claimed:

useradd: group 11 exists - if you want to add this user to that group, use -g.

So I typed:

$ useradd -g 11
useradd: group '11' does not exist

So I resorted to the original adduser command: adduser --force-badname 11 Allowing use of questionable username.

adduser: The group `11' already exists.

At this point, I was angry, but I used the groupdel command to delete group 11. I tried groupdel 11. After confirming the command worked, I went on the adduser command, and on the root account I typed adduser --force-badname 11.

And received the same error message as when I started!

Allowing use of questionable username.
Adding user `11' ...
Adding new group `11' (1010) ...
Adding new user `11' (1012) with group `11' ...
useradd: group '11' does not exist
adduser: `/usr/sbin/useradd -d /home/11 -g 11 -s /bin/bash -u 1012 11'
returned error code 6. Exiting.
  • 1
    This is a terrible, terrible idea. adduser and co. won't be the first set of problems you'll face. Any number of commands will be confused by numerical usernames. Don't do this. – muru May 31 '17 at 7:15
  • Well you COULD do useradd -g 11 -ou 11 11 and then passwd 11 for setting password (-g sets group and -ou system group and at the end is the name of the user) – ADDB May 31 '17 at 7:24
  • 1
    I don't quite understand why someone would create users and groups only based on numbers? What reason is there anyway... if you really want it create user01 or group01. Other then that you have the explanation why it's having issues from Ravexina's answer. – Ziazis May 31 '17 at 9:44
  • It's because I'm partaking in a little project which requires 100 user accounts, and it's much more practical/ocd-friendly to make then all numbers. Also because I want to know why it doesn't work, even if I were to change my account names, I wouldn't want to leave without knowing why it didn't work. I control the terminal, not vice versa. BTW, I did not submit the question. – Johan Liebert May 31 '17 at 16:21
  • @JohanLiebert the why is simple: If a command accepts both usernames and user IDs, a username which is entirely numerical can be taken for either. By the way, disabuse yourself of the notion that you "control the terminal". Unless you wrote every command you use, that is simply false - each time you run a command, you're negotiating between your needs and what the command can do, and your actions always dictated by what the available commands can do. – muru Jun 1 '17 at 9:26

Don't do this, instead use a username which starts with a characters like u11.

Here is what's happening:

You are trying to create a user named 11, so a group will be created named 11 at the same time as your user's primary group.

This newly created group will get an id bigger that of > 1000 like: 1003 which in your /etc/group file its line going to be: 11:x:1003.

While adding this new user useradd tries to add it to its primary group which is 11, however when doing this, it thinks that the 11 is a group id so it complains that there is no such group with the id of 11.

  • When it says "group 11 exists", it means you have a group named "11", and
  • When it says "group '11' does not exist", it means that I can't find any group with the id of "11".

Why it worked for first 10 account

Because by default there are some groups with the ID of 0 to the 10 in a Ubuntu system. so it assign your users to these groups and does not complain about it. However with the 11, you've got a group named 11 but no group with the id of 11.


So as muru said it's just the start of your problems, do not do this. however if you insist to fix the issue you should find the group id and use that:

$ grep ^11 /etc/group

$ sudo useradd 11 -g 1003

Do not forget to use usermod to change the first 10 users group id too.

  • OMG! SO helpful! One question though, is there a better way to create such a group than a failed adduser commad, and then the sudo useradd xx -g 10yy? – Johan Liebert May 31 '17 at 8:40
  • You can accept the answer if you think it was helpful to you :-) about your question: you can use groupadd to add the groups first then use useradd uname -g gid to create your users. Again it's not a good thing to do ;) – Ravexina May 31 '17 at 8:52
  • Whoops, my bad. Upvoted your answer. I finished making my 100 accounts. Apparently, on my os, the group was always one number less + 1000. So when I used the grep command for account 11, I got group 1010. When I used it for 61, the group was 1060. – Johan Liebert Jun 2 '17 at 17:14
  • @JohanLiebert You can accept the answer if you like by clicking on the gray tick under number 4 ;) – Ravexina Jun 2 '17 at 17:16
  • I did, but it said if the answer does not have 15 acceptations, the puclic score will not change. – Johan Liebert Jun 2 '17 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.