Creating a New User on Ubuntu Server 24

@fakhrulnugrohoJune 16, 2025

Creating users is one of the first tasks on any fresh Ubuntu Server β€” and the place where a careless sudo grant can haunt you later. This is the sequence I use on Ubuntu Server 24: create the user, grant privileges only when they're actually needed, and verify the account works before moving on.

πŸ’» Step 1: Access the terminal

If you're working directly on the server, you're already there. Remotely, log in over SSH:

BASH
ssh your-username@your-server-ip

πŸ‘€ Step 2: Create the user

adduser is the friendlier of Ubuntu's user-creation commands β€” it creates the home directory, sets the shell, and prompts for the details interactively:

BASH
sudo adduser newuser

You'll be asked to:

  1. Enter and confirm a password for the new user.
  2. Fill in optional details (Full Name, Room Number, and so on) β€” press Enter to skip any of them.

πŸ” Step 3: Grant administrative privileges (only if needed)

On Ubuntu, membership in the sudo group is what grants admin rights. Skip this step unless the user genuinely needs it β€” most day-to-day and service accounts don't:

BASH
sudo usermod -aG sudo newuser

βœ… Step 4: Verify

Check that the home directory exists:

BASH
ls /home

Then switch to the account and confirm the password works:

BASH
su - newuser

If you granted sudo, verify that too with sudo -v while logged in as the new user.

πŸ“Œ Useful commands for later

πŸ”š Conclusion

That's a working, verified user account β€” with elevated privileges only if you deliberately granted them. From here, the natural next step is setting up SSH key access for the new user instead of relying on passwords.

Happy coding πŸš€