What does a basic adduser run look like?
sudo adduser rosa
It creates the user and a group of the same name, builds /home/rosa, copies the files from /etc/skel, sets bash as the shell and asks for a password twice. Optional prompts for full name and phone numbers follow; press Enter to skip them. On Debian 12 and 13, the new home folder is private, mode 700, so other users cannot browse it; Ubuntu uses 750.
How do I create a key-only user without a password?
For people who will log in with SSH keys only, skip the password entirely:
sudo adduser --disabled-password --comment "Rosa Lind" rosa sudo install -d -o rosa -g rosa -m 0700 ~rosa/.ssh sudo tee /home/rosa/.ssh/authorized_keys </tmp/rosa.pub >/dev/null sudo chown rosa:rosa /home/rosa/.ssh/authorized_keys; sudo chmod 600 /home/rosa/.ssh/authorized_keys
--disabled-password leaves the account without a usable password, so password login is impossible while SSH keys work. Such a user cannot answer sudo password prompts, which is fine for non-admins. Older releases use --gecos instead of --comment; Debian 13 accepts the new name and warns about the old one.
How do I add an existing user to a group with adduser?
Give two names: the user, then the group.
sudo adduser rosa sudo sudo adduser rosa systemd-journal
This is a safe shortcut for usermod -aG: it only ever adds one membership, so there is no risk of wiping existing groups. The opposite, sudo deluser rosa sudo, removes that one membership. Group basics are in Add a user to a group.
Which options are worth knowing?
| Option | Effect |
|---|---|
--uid 2105 | Choose the user ID |
--ingroup developers | Use an existing group as primary instead of creating one |
--home /srv/rosa | Put the home folder somewhere else |
--shell /usr/bin/zsh | Choose the login shell |
--no-create-home | Skip the home folder |
--system | Create a service account with a low UID and nologin |
--add-extra-groups | Also add the groups listed in EXTRA_GROUPS |
How do I make a service account?
sudo adduser --system --group --home /var/lib/feedsync --shell /usr/sbin/nologin feedsync
--system picks a UID from the system range and sets no password; --group creates a matching group. Run the service as this account with User=feedsync in its systemd unit, so a compromise of the service stays inside that account's files.
Where are adduser's defaults set?
In /etc/adduser.conf. The useful keys:
DSHELL: default login shell.DIR_MODE: mode of new home folders.FIRST_UIDandLAST_UID: the range for regular users.EXTRA_GROUPSwithADD_EXTRA_GROUPS=1: groups every new user joins.NAME_REGEX: the pattern a user name must match.
If adduser rejects a name with "Please enter a username matching the regular expression", the name breaks NAME_REGEX, often because of capital letters or a leading digit. Choose a lowercase name rather than loosening the rule; many tools assume conventional names.
Is adduser available on other systems?
Only in the Debian family in this form. On Rocky Linux, AlmaLinux and CentOS Stream, adduser is a link to useradd, so these options do not exist there; use useradd's flags. FreeBSD has its own interactive adduser script with different questions. The comparison is laid out in useradd vs adduser.
What should follow creating the account?
Three things: an SSH key in authorized_keys, the right groups, and a test login from a fresh terminal. For an admin, add the sudo group and confirm with sudo -v, as in Create a sudo user on Debian. On every machine we deliver, root's password from the panel stays usable until you decide otherwise, so set up the personal account first and tighten root afterwards.
Keep Reading
useradd vs adduser
Why two commands exist for the same job, how they differ on Debian versus Enterprise Linux, and which one to use in scripts.
OpenAdd a user to a group
Put an account into supplementary groups without dropping its others, change its primary group and make new membership take effect.
OpenCreate a sudo user on Debian
Add an admin account on Debian 13 or 12, give it sudo rights, install your SSH key and retire daily root logins safely.
OpenDebian
Debian 13 or 12 for servers that should change as little as possible between upgrades, on any machine we sell.
OpenFAQ
Quick Answers
Run sudo adduser followed by the name and answer the prompts; it creates the home folder and sets a password.
Use adduser --disabled-password, then install an SSH key for login.
Yes. sudo adduser user group adds that single membership without touching others.
In /etc/adduser.conf, including shell, home mode, UID range and extra groups.
It does not match NAME_REGEX. Use lowercase letters and start with a letter.