OnCallReady

Commands

useradd - create a new user or update default new user information

useradd [options] LOGIN

Options you will use

-m, --create-home
Create the home directory from /etc/skel. On Debian/Ubuntu this is NOT the default: without -m there is no home directory.
-s, --shell SHELL
Login shell. The Debian default is /bin/sh; pass /bin/bash for a human, /usr/sbin/nologin for a service account.
-r, --system
System account: UID below 1000, no home, no aging.
-g, --gid GROUP
Primary group (default: a new group named after the user).
-G, --groups G1,G2
Supplementary groups.
-u, --uid UID
Numeric UID.
-c, --comment TEXT
GECOS field.
-m, --create-home
Create the home directory.
-M, --no-create-home
Do not create the home directory.
-d, --home-dir HOME_DIR
Use HOME_DIR as the home directory.
-s, --shell SHELL
The login shell; /usr/sbin/nologin for service accounts.
-r, --system
Create a system account (UID below 1000, no aging).
-g, --gid GROUP
The primary group.
-G, --groups GROUPS
Supplementary groups, comma separated.
-u, --uid UID
The numeric user ID.

Examples

$ sudo useradd -m -s /bin/bash -G ops alice

a human with a home and bash, in ops

$ sudo useradd -r -s /usr/sbin/nologin -d /opt/app appsvc

a service account nobody can log in as

Gotchas

Taught in

Try useradd in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.