Linux for Developers
/Intermediate
usermod
Definition
User Modify. A command used to modify the properties of an existing user account, such as changing their login name, home directory, or group memberships.
Explain Like I'm New
Updating an employee's badge. You use this to promote someone into a new team (group) or change their username.
Real World Example
You need to give Bob administrative `sudo` privileges. You type `sudo usermod -aG sudo bob`. This appends Bob to the 'sudo' group, granting him admin rights.
Common Use Cases
- •Managing permissions
- •Locking/Unlocking accounts
Interview Questions
basic
- What does the `-L` flag do in `usermod -L bob`?
intermediate
- Why MUST you use the `-a` (append) flag when adding a user to a new group with `-G`?