Vultr DocsLatest Content

How to Create a Sudo User on a Linux Server

Updated on 06 November, 2025
Learn how to create and configure a sudo user on Ubuntu, Debian, CentOS, AlmaLinux, Rocky Linux, and FreeBSD systems securely.
How to Create a Sudo User on a Linux Server header image

Creating a sudo user improves security by allowing you to perform administrative tasks without logging in as the root user. It helps reduce the risk of accidental system wide changes and improves auditing capabilities. By assigning sudo privileges to specific users, you can also achieve finer grained permission management and control who can perform administrative operations.

This article explains how to create a sudo user on multiple distributions, including Ubuntu, Debian, and FreeBSD.

Prerequisites

Before you begin, you need to:

  • Have access to a Linux server as a root or non-root user with sudo privileges.
Create a Sudo User on Ubuntu and Debian

Follow the steps below to create a new user and give them sudo privileges.

  1. Create a new user. Replace john with your desired username.

    console
    $ sudo adduser john
    

    When prompted, enter a password for the user and other additional information such as full name or phone number.

  2. Add the new user to the sudo group to grant sudo privileges.

    console
    $ sudo usermod -aG sudo john
    
  3. Switch to the newly created user account.

    console
    $ sudo su - john
    
  4. Run a sudo command to confirm that the user has sudo privileges.

    console
    $ sudo whoami
    

    When prompted, enter the user's password. If the command returns root, it confirms that the user can execute commands with sudo privileges. For advanced configurations, such as managing password prompts or restricting specific commands, refer to this article.

Conclusion

In this article, you learned how to create a sudo user in Debian-based and FreeBSD systems. You created a new user, assigned the appropriate group membership (sudo or wheel), and verified administrative access using sudo. These steps improved system security by limiting direct root usage and enabled controlled, auditable administrative privileges across different operating systems.

Comments