Modify user accounts, groups and settings from the shell with precision. 25.05.2026 | reading time: 2 min User management often happens at the shell; `usermod` is the tool to change a user's login name, UID, home, shell and group memberships without recreating the account. Real situation: add a user to sudo and docker A developer needs elevated rights and docker access; check current groups, add both groups, then verify membership with one command sequence shown below in a single trace for clarity: ```bash $ id alice uid=1001(alice) gid=1001(alice) groups=1001(alice) $ sudo usermod -aG sudo,docker alice $ id alice uid=1001(alice) gid=1001(alice) groups=1001(alice),sudo,docker ``` Common flags and gotchas Use `-aG` to append secondary groups, otherwise `-G` will replace them; `-l` renames the login, `-d` changes the home and `-m` moves its contents, `-s` sets the login shell, `-u` changes the UID and `-g` the primary group; always check running processes and file ownerships when altering UID or moving homes, and remember that `usermod` does not update crontabs or open file descriptors automatically. When not to use usermod Do not use `usermod` to create users or groups; prefer `useradd` and `groupadd` for initial setup, and avoid mass changes without a backup because UID/GID edits can orphan files; test in a VM or container if in doubt. Commands that complement usermod Pair `usermod` with `passwd` to set passwords, `chown` to fix ownership after UID changes, `gpasswd` or `groupmod` to manage groups, and `vipw`/`vigr` for safe manual edits to passwd and group files. Final word and next steps Mastering `usermod` makes account maintenance efficient and safer; keep practicing, pair changes with backups, and consider formal study—pursue CompTIA Linux+ or LPIC-1 and use bitsandbytes.academy for intensive exam preparation if you want certification-focused training. Join Bits & Bytes Academy First class LINUX exam preparation. utilities security processes scripting