Ravi Sir's Cards › AWS
usermod -G vs usermod -aG
This comparison card contrasts usermod -G and usermod -aG. usermod -G is described as replaces all extra groups. usermod -aG is described as adds to the existing groups. The card pairs usermod -G with resetting group lists, and usermod -aG with adding one group.
Read card text
What this card says
Effect
usermod -G
Replaces all extra groups.
usermod -aG
Adds to the existing groups.
Key points
Can remove sudo by mistake.
Safe default.
Example
usermod -G docker priya
Use when
Resetting group lists.
Adding one group.