commands.sh

useradd

linux

Create a new user. See also: `users`, `userdel`, `usermod`.

More info →

Options (6)

-u, --uidboolean

Create a new user with the specified user ID

Example: sudo useradd {{[-u|--uid]}} {{id}} {{username}}
-s, --shellboolean

Create a new user with the specified shell

Example: sudo useradd {{[-s|--shell]}} {{path/to/shell}} {{username}}
-G, --groupsboolean

Create a new user belonging to additional groups (mind the lack of whitespace)

Example: sudo useradd {{[-G|--groups]}} {{group1,group2,...}} {{username}}
-m, --create-homeboolean

Create a new user with the default home directory

Example: sudo useradd {{[-m|--create-home]}} {{username}}
-k, --skelboolean

Create a new user with the home directory filled by template directory files

Example: sudo useradd {{[-k|--skel]}} {{path/to/template_directory}} {{[-m|--create-home]}} {{username}}
-r, --systemboolean

Create a new system user without the home directory

Example: sudo useradd {{[-r|--system]}} {{username}}

Examples (7)

Create a new user

sudo useradd username

Create a new user with the specified user ID

sudo useradd [-u|--uid] id username

Create a new user with the specified shell

sudo useradd [-s|--shell] path/to/shell username

Create a new user belonging to additional groups (mind the lack of whitespace)

sudo useradd [-G|--groups] group1,group2,... username

Create a new user with the default home directory

sudo useradd [-m|--create-home] username

Create a new user with the home directory filled by template directory files

sudo useradd [-k|--skel] path/to/template_directory [-m|--create-home] username

Create a new system user without the home directory

sudo useradd [-r|--system] username
made by @shridhargupta | data from tldr-pages