Create a new user account on the Linux system.
medium risk
useradd creates user accounts in /etc/passwd. -m creates a home directory, -s sets the login shell, -G adds to supplementary groups, -r creates a service account without login. On Debian/Ubuntu, `adduser` is the friendlier interactive wrapper.
| Flag | Meaning |
|---|---|
-m --create-home | Create a home directory for the new user |
-s --shell | Set login shell (e.g. /bin/bash or /usr/sbin/nologin) |
-G --groups | Add to supplementary groups (comma-separated) |
-u --uid | Specify a numeric user ID |
-r --system | Create a system account (no home, no interactive login) |
useradd -m -s /bin/bash -G sudo,docker deployCreate deploy user with home, bash, and sudo+docker access · explain & risk-check →useradd -r -s /usr/sbin/nologin prometheusCreate a service account with no login shell for Prometheus · explain & risk-check →useradd -m -u 1500 -G developers aliceCreate alice with a specific UID and developers group · explain & risk-check →For service accounts always use `-r -s /usr/sbin/nologin` — prevents interactive login while still allowing the service to run as that user.
Reference text is hand-written and may be incomplete — check man useradd for your version. Test destructive commands on a non-production system first.