• Start Here
    • How to Install Linux
    • Which Distro To Choose
    • 10 Best Linux Distributions of 2023
  • Distros
    • Ubuntu
  • Linux Commands
  • Virtualization
  • Open Source
Linux Start
  • Start Here
    • How to Install Linux
    • Which Distro To Choose
    • 10 Best Linux Distributions of 2023
  • Distros
    • Ubuntu
  • Linux Commands
  • Virtualization
  • Open Source
Linux Start
Home»Distros»Ubuntu»How to Add Users in Ubuntu

How to Add Users in Ubuntu

Anup ThapaBy Anup ThapaFebruary 24, 2023 Ubuntu 3 Mins Read

There are many reasons to create multiple user accounts on Ubuntu. For starters, each user gets to customize the settings to their preference while keeping their personal files separate. You also get to manage the level of privilege associated with each account.

Creating a user account from the terminal is a very simple task, but Ubuntu also lets you add users via the Settings app for those who prefer the GUI approach. You’ll need an account with sudo privileges for both methods. 

Create a New User (CLI)

You can use the adduser or useradd commands to create a new user account. Adduser conveniently automates the whole process by default (creating the user, group, adding the user to the group, creating the home directory, setting the password, and so on). Useradd lets you perform the exact steps you want manually.

Let’s use adduser to create an account named Anup as an example. Remember to replace anup with your own username in the steps that follow.

sudo adduser anup

Input the password and additional user information. Once you’re done, you can verify that the account was created with

id anup

If you want to use useradd instead, the syntax is similar. The only difference is you’ll also need to include the -m flag to create a home directory for the user.

sudo useradd -m anup  

Once again, you can verify the result with

id anup

After verifying, set a password for the new user.

sudo passwd anup

And if you ever need to delete a user account, you can use the deluser command as shown below.

sudo deluser anup

Granting Sudo Privileges

The primary group that a user belongs to is automatically created when adding the user account. But you can also add a user to additional groups afterward. For instance, admins commonly need to add or remove certain users from the sudo group. 

The basic syntax for adding a user to a group is

sudo usermod -aG <group> <user>

In our case, we’ll add Anup to the sudo group with

sudo usermod -aG sudo anup

Like earlier, you can verify the change with

id anup

Alternatively, you can directly add a user to a specific group when creating the user. We’ll use the -G option to add anup to the sudo group as an example.

sudo useradd -mG sudo anup

Create a New User (GUI)

As stated, you can also perform the same tasks from the Settings app if you’d rather not use the terminal.

  1. Search and open ‘Users’ from the Applications menu.
    ubuntu user settings
  2. Click on Unlock from the top-right and enter your password to authorize further changes.
    unlock user settings ubuntu
  3. Press the Add User button.
    add user ubuntu
  4. Select the Account Type, fill in the user details, and press Add.
    add user account type name password
  5. After adding the new user, you can also modify the username and account settings if you want.
    remove user ubuntu
Anup Thapa
  • LinkedIn

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. At LinuxStart, Anup is an integral part of our editorial team. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys experimenting with different Linux distros and reading up on things like networking and virtualization.

Leave A Reply Cancel Reply

Table of Contents
  • Create a New User (CLI)
  • Granting Sudo Privileges
  • Create a New User (GUI)
Linux Start
Guides

What is the Linux Kernel?

The Linux Kernel is the core of the Linux operating system and is central to…

How To Install Linux Mint

How To Install Linux on VirtualBox

Getting Started with Linux

How to Install Linux

10 Best Linux Distros of 2023

Which Linux Distro Should You Choose? A Complete Guide to Help You Decide

© 2023 LinuxStart.com

Type above and press Enter to search. Press Esc to cancel.