Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Distributions»Debian»How to Create a Sudo User in Debian

    How to Create a Sudo User in Debian

    RahulBy RahulJune 19, 20212 Mins ReadUpdated:June 26, 2021

    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.

    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
    Previous ArticleHow To Install XRDP (Remote Desktop) on Debian 10
    Next Article Wget Command in Linux with Examples

    Related Posts

    Bash Printf Command

    Updated:December 23, 20212 Mins Read

    (Resolved) -bash: /bin/mv: Argument list too long

    Updated:January 13, 20222 Mins Read

    Tee Command in Linux with Examples

    4 Mins Read

    Handling filenames with spaces in Linux

    3 Mins Read

    Chown Command in Linux with Examples

    Updated:August 16, 20215 Mins Read

    JQ Command in Linux with Examples

    5 Mins Read

    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

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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