How to Create a New Sudo User on Linux Mint 21/20

Managing user access and privileges is a critical aspect of ensuring the security and stability of any Linux system. In this article, we explore the concept of sudo, its importance in Linux Mint, and some common use cases. By understanding the role of sudo in managing user access and permissions, administrators can effectively control system access, reducing the risk of unauthorized actions.


  • Recommended OS: Any current Linux Mint OS
  • User account: root access

Understanding Sudo

Sudo, short for “superuser do,” is a command-line utility that allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. The main purpose of sudo is to grant certain users or groups the ability to execute specific commands with root privileges, without the need to provide them with full root access.

Sudo Use Cases in Linux Mint

In Linux Mint, sudo plays a vital role in providing security and flexibility for system administration. Some common use cases include:

  1. System Maintenance: Sudo allows authorized users to perform essential system maintenance tasks, such as updating software, installing new packages, and managing services.
  2. User Management: With sudo, administrators can create, modify, and delete user accounts, as well as control their access to the system and specific resources.
  3. File Management: Sudo enables users to manipulate files and directories that would otherwise be restricted, such as system configuration files or log files.
  4. Security: By limiting the number of users with full root access, sudo minimizes the risk of accidental or malicious system changes, enhancing overall security.

Changing to Root (su)

To create new sudo users, you must first switch to the root user using the su command. By default in Linux Mint, the root account has no password set. Therefore, you need to set a password for the root account before proceeding, using the following command:

sudo passwd root

You will be prompted to enter your sudo account password. After verification, enter a new root password.


example to reset root account password if forgotten to add a new sudo user on linux mint 21 or 20Pin

Adding a User to the Sudoers Group on Linux Mint

Now that you have set your root password switch to the root user using the su command:


You will be prompted for the root password. After entering it, the username will change to root.


example logging into root account to add a new sudo user on linux mint 21 or 20Pin

Creating a New User Account on Linux Mint

The first step is to learn how to add a new user account. You can grant permission to an existing account, but in this tutorial, we will create a user from scratch.

First, create the user account with your desired username:

adduser <desired_username>


adduser josh

After executing this command, you will be prompted to enter a new password for the user and confirm it. For anyone with sudoers access, use a strong password containing uppercase, lowercase, symbols, numeric values, and special characters.

Now, you will be prompted for additional information about the new user. Fill out the details as accurately as possible, or press Enter to skip.


example adding new user with root account on linux mint 21 or 20 for new sudo userPin

After completing the details, type “Y” and press Enter to proceed.

Confirm that the user has been added by running the following command:

cat /etc/passwd

Example output:

using cat command to print out all users to confirm new user added on linux mint 21 or 20Pin

Adding the New User to the Sudoers Group on Linux Mint

In this part of the tutorial, you will give the new user or an existing user sudoers access by typing the following command:

usermod -aG sudo <desired_username>

Example using the name we created:

usermod -aG sudo josh

Verifying if the user was successfully added to the sudoers group is a good idea. To do this, run the id command:

id <username>

Example using the name we created:

id josh

Example output:

id command to check sudo added to new user on linux mint 21 or 20Pin

Alternatively, you can use the gpasswd command as follows:

gpasswd -a <example username> sudo

Example using the name we created:

gpasswd -a josh sudo

Example output:

adding josh to group sudo

Confirm and Test the New Sudo User

Now that you have successfully added the desired user to the sudoers group, it’s time to test the account. You can do this using the su command, followed by the username:

su <example username>

Example using the name we created:

su josh

Now, confirm the username with the sudo command along with whoami:

sudo whoami

You will be prompted to enter the sudo username and its password. After entering and confirming them, you will see the following output:

whoami command to confirm sudo added to new user on linux mint 21 or 20Pin


In summary, sudo is an indispensable tool for managing user access and permissions in Linux Mint. It offers a secure and flexible way to control system access, making it easier for administrators to maintain system stability and security. Understanding how to use sudo effectively is crucial for anyone responsible for managing a Linux Mint system.

Additional Resources

Below is a list of relevant resources to help you gain a deeper understanding of sudo and its use in Linux Mint:

  • Official Sudo Website: The official website of the sudo project, containing documentation, FAQs, and download links.
  • Linux Mint Community: A platform where Linux Mint users can share knowledge, ask questions, and find solutions to common issues.
  • Ubuntu Sudo Wiki: A comprehensive guide on sudo usage in Ubuntu, which is also applicable to Linux Mint, as both distributions share similar functionalities.
  • Sudo Man Page: Official manual page for the sudo command, providing detailed information on command syntax and options.
  • Linux Mint Forums: An active community forum for Linux Mint users, offering support, tutorials, and discussions on various topics related to the distribution.

Share to...