Is there a possibility to define a default group for new Users? I mean I define the group testgroup as the default usergroup and when I add User1 and User2, both new Users would be in the group testgroup without defining this group on the useradd command as following?

# useradd -G testgroup User1


 # useradd -D

I get on the first line GROUP=100. But when I add a new User, the new user is added to a group called as the new user but not to the group with the id=100. For what is this definition?


You have to change the following line in /etc/login.defs to make the GROUP default in /etc/default/useradd active.


From man useradd

...By default, a group will also be created for the new user (see -g, -N, -U, and USERGROUPS_ENAB)...

The why is probably because of security thoughts. But I am sure there are already some post somewhere out there discussing this. So open the search engine of your choice and...

| improve this answer | |

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.