Create a New User with useradd

Add a local account with home directory and shell in one command, then set its password.

LinuxaccountsuseradministrationMedium risk
Run sudo useradd -m -s /bin/bash alice to create the account and home directory, then sudo passwd alice to set a password.

01Command

Command
$ sudo useradd -m -s /bin/bash alice && sudo passwd alice

02What it does

-m creates /home/alice populated from /etc/skel, without it the account has no home directory and many apps misbehave; -s picks the login shell. useradd deliberately does not set a password — the new account stays locked (usable only via sudo su) until you run passwd for it. On desktop distros adduser is a friendlier interactive wrapper, but useradd is the portable, scriptable core tool.

03Risk

RiskMedium risk
Requirementsshadow-utils (preinstalled); root via sudo
!Warning: Creating accounts without setting a password or SSH key leaves a locked, easy-to-forget account; check /etc/login.defs for your distro HOME_MODE defaults.

04Undo

Undo
$ sudo userdel -r alice

05Sources

  • useradd(8) — create a new user
    man7.org · community · 2026-09-17
    Evidence: Documents -m/--create-home and -s/--shell options plus -c comment; confirmed the strings -m, --create-home and -s in the man page text.
  • useradd(8) — Debian man page (passwd)
    Debian manpages · community · 2026-09-17
    Evidence: Man page documents -m creating the user home directory and -s setting the login shell; text contains -m and create home descriptions.

Last verified: 2026-09-19 · Category: System & Settings

06Related solutions