usermod Command Generator
Generate usermod commands to modify a user account
Getting Started with usermod
## What is usermod?
`usermod` modifies an existing user account: supplementary groups, login shell, home directory, login name, and lock/unlock state. It requires root privileges.
## How to Use
1. **Pick Changes**: Set groups, shell, home directory, or account lock state. 2. **Enter Username**: Provide the target account name (the positional argument). 3. **Use -a with -G**: To add to groups without removing existing ones, always combine `-a` and `-G`. 4. **Copy & Run**: Copy the generated command into your terminal.
Common Options
### `-aG` Append to groups Add the user to supplementary groups while keeping current ones. `-G` alone replaces the group list, so always use `-a` with it for additions.
### `-s` Login shell Set the user's login shell (for example `/bin/zsh` or `/bin/bash`).
### `-l` New login name Rename the login account. The home directory is not moved automatically.
### `-d` Home directory Change the user's home directory path. Pair with `-m` to move existing files.
### `-m` Move home contents Move the current home directory contents to the new location set by `-d`.
### `-L` Lock Lock the account (prepend `!` to the password hash).
### `-U` Unlock Reverse `-L` — restore password login.
▶How do I add a user to the sudo and docker groups?
▶Why did usermod -G sudo remove my user from docker?
▶How do I change a user's shell and move their home?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee