Site icon New Generation Enterprise Linux

Stop getting locked out because you fat-fingered your own group membership

User & Group Management

Stop getting locked out because you fat-fingered your own group membership

đź§© The Challenge

You ever run usermod to add yourself to a new group, mistype the flag, and suddenly find your session unresponsive or your sudo access revoked? I’ve spent more than one Friday night staring at a login screen wondering why the hell my own account decided to lock me out.

đź’ˇ The Fix

Always use the append flag when you modify group memberships, and verify your active groups in your current shell before you close that terminal. It saves you from accidentally nuking the groups you were already part of.

usermod -aG sudo,docker $(whoami)
id

⚙️ Why It Works

Adding the -a flag ensures you only add to the existing list rather than overwriting it entirely, which is the default behavior that kills your session access. You’ll avoid a total lockout by treating group updates as an additive process.

🚀 Pro-Tip: If you actually do manage to lock yourself out, just flip your local machine to single-user mode or use the rescue shell from your cloud provider’s console.

Linux Tips & Tricks | © ngelinux.com | 9/20/2026

0 0 votes
Article Rating
Exit mobile version