添加用户时提示“useradd: group '100' does not exist”错误求助
Hey there, let's break down what's going on here and fix that useradd error you're seeing.
The Root Cause
The error pops up because your /etc/default/useradd file is configured to use GROUP=100 as the default primary group for new users—but this group (with GID 100) no longer exists on your system. Since you mentioned creating, modifying, and deleting users/groups previously, it’s likely you accidentally removed the group assigned to GID 100 at some point.
When useradd can’t locate the group specified in that default config, it throws the "group '100' does not exist" error and ignores the GROUP= setting, which explains the second message you’re seeing.
Step-by-Step Fixes
Here are two straightforward ways to resolve this:
Option 1: Recreate the GID 100 group
First, confirm the group is truly gone by running:
cat /etc/group | grep ":100:"
If you get no output, the group doesn’t exist. Recreate it with:
sudo groupadd -g 100 default-users
You can replace default-users with whatever name you want (maybe the original name of the group you deleted, if you remember it).
Option 2: Update the default GROUP setting to an existing group
- First, list all existing groups to pick a valid one:
cat /etc/group
Look for a group you want to use as the default (the test group you mentioned in your command is a good candidate if it still exists).
- Edit the
/etc/default/useraddfile with your preferred editor (like nano):
sudo nano /etc/default/useradd
Change the line GROUP=100 to either:
- The name of an existing group:
GROUP=test - Or the GID of an existing group (find it in the
/etc/groupoutput—it’s the third field separated by colons)
- Save the file (in nano, press
Ctrl+O, thenEnter, thenCtrl+Xto exit).
Verify the Fix
Once you’ve done either option, test creating a user again:
sudo useradd anyuser
This should run without errors now. If you want to clean up, you can delete the test user with sudo userdel anyuser.
内容的提问来源于stack exchange,提问作者Riz

