User and Group Management

usermod

Modifies existing user accounts.

usermod changes login name, home directory, shell, groups, lock state, and other account properties.

Syntax
usermod [options] username

Arguments explained

  • username is the account to modify.
  • -aG appends supplementary groups.
  • -s changes shell.
  • -L locks the password.
  • -U unlocks.

Common examples

Add user to a group
sudo usermod -aG docker alex

Adds alex to docker without removing existing groups.

Change login shell
sudo usermod -s /bin/zsh alex

Sets alex's login shell to Zsh.

usermod Command
FieldDetails
Commandusermod
CategoryUser and Group Management
Primary useModifies existing user accounts.
Syntaxusermod [options] username