Creating a user is an administrative task, so it runs as root (or with sudo). The fastest correct command:
sudo useradd -m -s /bin/bash deploy
sudo passwd deployThe first line creates the account with a home directory and a real shell; the second sets its password. That is the whole job. Here it is for real:

What the flags do
-mcreates the home directory (/home/deploy). On Debian and Ubuntu,useraddskips the home directory unless you pass-m, which breaks logins and dotfiles; on RHEL, Fedora, and Rocky it is created by default (CREATE_HOME yesin/etc/login.defs), so-mis a harmless no-op there. Pass-manyway: it is portable and idempotent. This is the flag people forget.-s /bin/bashsets the login shell. Omit it and you get the distro default, which on some systems is/bin/shor even/usr/sbin/nologin.-G developers,dockeradds the user to extra (secondary) groups at creation.-c "Deploy Bot"sets the comment/full-name field.
useradd vs adduser
This is the part that confuses people, because both exist and do similar things.
| Command | What it is | Behavior |
|---|---|---|
useradd | The low-level binary, present on every Linux | Does exactly what you flag, nothing more. No home dir unless you pass -m, no password prompt. |
adduser | A friendly Perl/shell wrapper (Debian/Ubuntu) | Interactive: creates the home dir, copies /etc/skel, and prompts for a password and details. |
On Debian and Ubuntu, adduser deploy is the nicer interactive path:
sudo adduser deployIt walks you through the password and finger info and sets up the home directory for you. On RHEL, Fedora, Arch, and Alpine, adduser may be missing or just a symlink to useradd, so useradd -m is the portable choice. When in doubt, use useradd -m -s /bin/bash and set the password separately; it works everywhere.
Give it a password (or don't)
sudo passwd deploy # set an interactive login passwordFor a service account that should never log in directly, skip the password and give it no shell instead:
sudo useradd -r -s /usr/sbin/nologin appsvc-r makes it a system account (low UID, no aging), and nologin blocks interactive logins while still letting services run as that user.
FAQ
See also
- How to Create a Group on Linux: the groups you assign with
-G. - How to Add a User to a Group: grant group membership after the fact.
- How to Give a User sudo Access: make the new account an admin.
- How to Delete a User on Linux: the reverse, cleanly.
Sources
Authoritative references this article was fact-checked against.
- useradd(8) - Linux manual page (man7.org)man7.org
- adduser(8) - Debian manual pagemanpages.debian.org





