Stop your new users from having the wrong primary group
User & Group Management
Stop your new users from having the wrong primary group
🧩 The Challenge
Setting up a bunch of new dev accounts only to realize they all defaulted to the GID of 100 or some weird catch-all group is a headache. You fix their permissions for an hour and then realize everything they upload later still has the wrong owner because of the system defaults.
💡 The Fix
Change the default primary group for future user accounts by tweaking your login defaults so you don’t have to manually override it every time you run useradd. It saves you from those awkward permission fights where files are suddenly inaccessible to the rest of the team.
sed -i 's/^USERGROUPS_ENAB.*/USERGROUPS_ENAB no/' /etc/login.defs && sed -i 's/^GID_MAX.*/GID_MAX 60000/' /etc/login.defs
⚙️ Why It Works
By flipping USERGROUPS_ENAB to no, you force the system to stop creating a private group for every new user, letting you use a more sane default you control via /etc/default/useradd. That way, new users land exactly where you want them without you having to clean up their mess later.
🚀 Pro-Tip: Always double check /etc/default/useradd after you touch login.defs, because that is where the system actually looks for the specific group ID when creating the home dir.
Linux Tips & Tricks | © ngelinux.com | 7/22/2026
