How to Add a User in Ubuntu

The Architecture Partitioning Vector

If you are onboarding a new developer to a production Ubuntu server, providing them with your personal root password or SSH keys is a catastrophic security failure. If they make a mistake, they could destroy the entire system. You must instruct the Unix kernel to mathematically partition the file system, generating a distinct, cryptographically isolated user profile with restricted permissions, specifically for that individual.

How to Add a User in Ubuntu

While the legacy `useradd` command exists, it requires complex manual configuration of home directories and bash shells. You should always use the interactive `adduser` utility, which automates the entire architectural setup.

1. Open your terminal application or connect to the server via SSH.
2. The Initialization Command: Because creating a user alters the core `/etc/passwd` security matrix, you must execute the command with superuser privileges (`sudo`).
* Type the command followed by the new user’s desired login name (e.g., “johndoe”).
* Critical Rule: The username must be entirely lowercase and contain no spaces.

sudo adduser johndoe

3. Press Enter. You will be prompted for your own administrative password to authorize the action.
4. The Interactive Configuration:
* The `adduser` script will instantly create a new home directory (`/home/johndoe/`) and copy the default bash configuration files into it.
* New password: The terminal will prompt you to assign a password for the new user. Type a highly secure password (the characters will remain invisible) and press Enter. Retype it to confirm.
* User Information: The script will ask for the user’s Full Name, Room Number, Work Phone, etc. You can simply press Enter to skip all of these fields, as they are largely irrelevant for modern servers.
* Final Confirmation: The script will ask `Is the information correct? [Y/n]`. Type Y and press Enter.
5. Administrative Override (Optional): The new user is currently a “Standard” user. If you want them to have the ability to run `sudo` commands (like installing software), you must manually add them to the `sudo` group using the `usermod` command:

sudo usermod -aG sudo johndoe

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.