Interview Prep/Linux/Permissions, Users & sudo

What does `usermod -G` without `-a` do?

IntermediateConceptPermissions, Users & sudo
Answer

It replaces the user's supplementary group list with exactly the groups given. Running usermod -G docker alice removes alice from sudo/wheel and every other group. Always use usermod -aG, or gpasswd -a alice docker, which only adds.

All Linux questions Roadmap: Linux

More on Permissions, Users & sudo