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]
- 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
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 s
udo 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.
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.