Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Commands»Creating Sudo User Account in Ubuntu & Debian

    Creating Sudo User Account in Ubuntu & Debian

    By RahulMarch 3, 20233 Mins Read

    In Ubuntu, the root user has full access to the system, which means that they can perform any task or modify any file without any restriction. However, giving full access to the root user can be risky, as it can lead to unintended system changes or even system failure. Therefore, it is recommended to create a sudo user in Ubuntu to manage the system’s administrative tasks while limiting the risk of system damage.

    Advertisement

    A sudo user is a regular user account that has been granted administrative privileges, allowing them to perform tasks that require root access without logging in as the root user. In this article, we will guide you on how to create a sudo user in Ubuntu.

    Step 1: Log in as Root User

    Before creating a sudo user, it’s essential to log in as the root user. To do this, open a terminal window and enter the following command:

    sudo su - 
    

    Enter your password when prompted to gain root access.

    Step 2: Create a New User

    Once you have logged in as the root user, the next step is to create a new user account. You can create a new user account by running the following command:

    adduser username 
    

    Here, replace the ‘username’ with the name you want to give to the new user.

    You will be prompted to set a password for the new user. Enter a strong password and confirm it.

    Step 3: Grant Administrative Privileges

    The next step is to grant administrative privileges to the newly created user. To do this, you need to add the user to the sudo group. Run the following command to add the user to the sudo group:

    usermod -aG sudo username 
    

    Here, replace ‘username’ with the name of the user you created in step 2.

    Step 4: Verify Sudo User

    Once you have added the user to the sudo group, you can verify whether the user has administrative privileges or not by running the following command:

    su - username 
    

    Here, replace ‘username’ with the name of the user you created in step 2.

    Enter the password for the user when prompted. If the password is correct, you will log in as the new user. To verify that the new user has administrative privileges, run the following command:

    sudo whoami 
    

    If the user has administrative privileges, the system will return ‘root’ as the output of the command.

    Conclusion

    Creating a sudo user in Ubuntu is an essential step in securing your system. It allows you to delegate administrative tasks to a user account while limiting the risk of system damage. By following the steps outlined in this article, you can easily create a sudo user in Ubuntu and grant them administrative privileges.

    sudo sudoers useradd
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    cp Command in Linux (Copy Files Like a Pro)

    dd Command in Linux (Syntax, Options and Use Cases)

    Top 10 JQ Commands Every Linux Developer Should Know

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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