Linux Commands Helper
💬 Your AI-powered Linux assistant
usermod Command - Modify a User Account
The usermod command is used to modify a user account in Linux. It can change user information, group memberships, login shell, home directory, and more.
Syntax
usermod [options] username
Examples
sudo usermod -s /bin/zsh alice
Change the login shell for user alice to zsh.
sudo usermod -aG sudo bob
Add user bob to the sudo group.
sudo usermod -d /home/newhome -m carol
Move carol's home directory to /home/newhome.
Notes
- Requires root privileges.
- Be careful when changing user IDs or home directories, as it may affect file ownership and permissions.
- Use
-aG
to append a user to a group without removing them from other groups.