Linux

usermod

CautionModify a user

usermod -aG <group> <user>

Add groups with -aG (forgetting -a REPLACES all groups). -L locks, -U unlocks the account.

Examples

  • usermod -aG docker taroAdd to docker group
  • usermod -L taroLock the account

Syntax

usermod [-aG groups] [-L|-U] [-s shell] <user>

Before you run it

Omitting -a wipes existing group memberships.

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store