Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Distributions»Debian»How to Create a Sudo User in Debian

    How to Create a Sudo User in Debian

    By RahulJune 26, 20212 Mins Read

    Sudo provides special privileges to users to run commands as another user. It can use used to allow superuser privileges to a normal user with restrictions. One can configure the sudo to give root privileges to the specific commands only.

    Advertisement

    This tutorial helped you to create a new user with Sudo privileges, add an existing user to sudo privileges or remove sudo privileges from any account.

    Create User with Sudo Access

    Use the system’s default “adduser” command to create a new account. As per current requirements the command syntax will be like:

    sudo adduser [USER_NAME} [GROUP_NAME] 
    

    Here:

    • USER_NAME is the name of the new user account.
    • GROUP_NAME Define a group name here to automatically add user to this group during creation.

    Let’s try with a real example. The following command will create a new user tecadmin and add it to sudo group.

    sudo adduser tecadmin sudo 
    

    In case of user already exist, it will simply add the user to the sudo group.

    Add Existing User to Sudo

    You can also use the following command to add existing users to group sudo, where it will get full sudo privileges.

    sudo usermod -aG sudo tecadmin 
    

    This will just add tecadmin user to the sudo group. One can verify the same in the /etc/group file.

    Remove Sudo Privileges from User

    The following command will remove a user from the sudo group. This will just remove the tecadmin user from the sudo group. It will not remove the user from the system.

    sudo gpasswd -d tecadmin sudo 
    

    We also recommend viewing the /etc/sources file and remove any user-specific entry.

    Conclusion

    This tutorial helped you to provide special permission to users using Sudo on a Debian system. Additionally, this tutorial provides you with permission to allow sudo access to the existing accounts. Also, remove Sudo privileges from the user.

    command sudo user
    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)

    Using the Apt Package Manager on Debian-based Systems

    View 1 Comment

    1 Comment

    1. Anders Jackson on January 27, 2022 7:06 pm

      I find it even simpler to just use `adduser(8)` to add a group to a user.

      $ adduser username sudo

      This will add the group `sudo` to the user.

      Reply

    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.