#

Users Permissions

Subscribe
Users Permissions October 29, 2026·7 min read

How to Create a Linux User with adduser or useradd

On Debian or Ubuntu, use adduser for a regular account you create interactively. Use useradd when you need explicit settings, repeatable provisioning, or your distribution's documented interface. Verify the account's identity, home directory, login shell, and authentication state before granting more access.

adduser vs. useradd: which should you use?

linux user commands

On Debian and Ubuntu, adduser guides you through setup and follows the distribution's account policies. useradd takes options for individual settings and applies local defaults to anything you leave out. Check the available utility on the actual distribution: Debian-family adduser helpers and the lower-level useradd interface do not always choose the same defaults.

SituationCommand to considerWhat to expect
Personal account created interactively on Debian or UbuntuadduserGuided prompts and local account policy
Account with deliberately specified propertiesuseraddYour options, system defaults for the rest
Repeatable scripted provisioninguseraddExplicit options, no interactive prompts
Rocky Linux or another RHEL-family hostDistribution-documented useradd workflowFollow your distribution's docs
Identity for a background serviceSystem-account optionsShell, home, and runtime needs set by the service

Don't expect the interactive Debian adduser workflow on every distribution.

linux account selection

One poster in a December 2024 r/linuxquestions discussion about the two commands put it this way: “I ALWAYS get confused and then subtle fury sets in as the user is only partially created and I have to run a bunch of commands to fix everything”.

Before creating the account, check the host and username

linux account preflight

Confirm the terminal is on the right machine and that you have root or sudo access.

Identify the operating system, since it decides which account tools and defaults you have:

cat /etc/os-release

Check whether the username already exists:

getent passwd exampleuser

Any output means the name is already in use in your configured Name Service Switch (NSS) lookup. If it prints nothing, the name is free.

exampleuser is a placeholder. Replace it with your account name in every command below.

Create a regular user with adduser on Debian or Ubuntu

ubuntu adduser command

Start the guided setup with:

sudo adduser exampleuser

adduser follows local account policy and prompts for the account password and optional information. The home directory, group arrangement, and login shell come from your adduser version and its configuration.

On Debian 13, an example using adduser 3.138 prints fewer informational messages than some older walkthroughs. A quieter session is normal and still means the account was created.

Create a user with useradd and explicit options

linux useradd options

To control a regular account's home creation and login shell yourself, run:

sudo useradd -m -s /bin/bash exampleuser

-m requests a home directory and -s /bin/bash records the shell path. The shell must exist on the host. UID allocation, primary-group behavior, and any other property you leave out follow the system's configuration.

useradd shell configuration

Set a local password as a separate step if the account needs one:

sudo passwd exampleuser

passwd prompts for the password interactively. In automated setups, supply credentials through a secure provisioning method, because a password in a command line or script is exposed.

Use -d to set a custom home path.

What the home and shell options control

linux home directory

The home path stored in the account record and the directory on disk are separate things. If you omit a flag, your local useradd configuration affects whether the directory is created.

OptionAccount settingFilesystem effect
-d /chosen/pathSets the home pathLeaves creation to -m or local policy
-mUses the configured or selected home pathRequests creation of the home directory
-MThe home path stays recordedBlocks home-directory creation

A July 2022 poster in an r/Ubuntu discussion about changing a home directory wrote, “Hello guys, when i create a new user and try to change home directory it does create the user but it's not creating the home directory”.

See the Linux useradd(8) manual for exact option definitions.

linux shell defaults

When the home directory is created, files from /etc/skel can populate it, depending on local settings. The login shell follows configuration too. -s sets the path you choose. Without it, one creation route can record sh and another Bash.

Check your configured useradd defaults, such as the home base and shell, with:

useradd -D

The output omits some account-creation policy. Settings such as CREATE_HOME are controlled through /etc/login.defs.

Verify the account instead of trusting the success message

linux account verification
CheckCommandWhat it shows
Account recordgetent passwd exampleuserUsername, UID, primary GID, home path, shell
Identity and groupsid exampleuserUID, primary and supplementary groups
Home directoryls -ld /actual/home/pathWhether it exists, plus ownership and permissions
Password statesudo passwd -S exampleuserPassword status on systems that support -S

A passwd-style record from getent passwd has colon-separated fields: login name, password placeholder, UID, primary GID, comment, home path, and shell. Read the home path from it before running ls -ld, since custom homes need not be under /home. Because getent uses NSS, the account can come from a source other than the local /etc/passwd file.

user directory ownership

A writer in a May 2025 r/Ubuntu post described that mismatch: “I created user using useradd CMD, and it is showing in /etc/passwd but is not showing up inside the home directory”.

Read the password status

On the Linux passwd implementation documented in passwd(1), the second status field from passwd -S is L for a locked password, NP for no password, or P for a usable password. Other implementations format it differently, so check their documentation.

A locked password doesn't disable SSH public-key authentication by itself.

Fix a missing home, unexpected shell, or unavailable login

linux user troubleshooting
SymptomFirst cause to investigateFix
Account exists, but its home is missingCreation flags, home path, local policyCheck for -m, inspect the path, create the directory, set ownership
Unexpected login shellRecorded shell and whether the binary existsChange the shell with usermod
Password login unavailablePassword state and the login method you wantSet a password if you want password login
Username already existsExisting account and its sourceInspect it before changing anything

Creating a custom home can fail even when you request it, if the parent path or its permissions block it. SELinux context can also affect creation on systems that use it. If the account already holds data, repair it in place and keep its files, ownership and profile setup. Don't erase and recreate it just to fix the path.

linux shell troubleshooting

To change an account's shell to Bash, make sure Bash exists at that path, then use the -s option documented in usermod(8):

sudo usermod -s /bin/bash exampleuser

That changes the recorded login shell, so use it only when the shell is the problem.

Don't run blanket permission changes such as chmod 777 during these repairs. Broad access adds a security risk and doesn't find the cause.

Service accounts are different from human login accounts

linux service accounts

A background service can need its own Linux identity with no ordinary interactive login. useradd has system-account options such as -r for that. Depending on the application, a non-login shell that exists on the host and -M can fit, but neither secures the service. For an identity such as backupsvc, work out the program's home, file ownership and runtime-access needs before picking settings.

Sudo, SSH, and file access come separately

linux user permissions

A new account has no admin rights and no special file access. You set those up separately. A regular user gets sudo only through sudo policy and its permitted user or group configuration.

linux access boundaries

SSH access needs server configuration and a working authentication method. A local lookup that finds the account tells you nothing about remote login.

If the account needs write access to a CSV directory, that directory's ownership, permissions and group membership decide what it can do. Your next tasks are configuring sudo policy, setting up SSH keys, or managing groups and filesystem permissions.

NoScript Team