Ubuntu Linux Linux Administration Linux Basics Linux Commands Linux Tips & Tricks Unix/Linux Beginners How To Add, Delete And Grant Sudo Privileges To Users In Ubuntu 26.04 LTS Learn How to Create sudo user in Ubuntu Linux.
By sk
Published: May 30, 2026
Written by sk
Published: May 30, 2026
22K views
8 mins read
0 comments
13 Facebook Twitter Linkedin Reddit Whatsapp Telegram Email 22K This detailed tutorial explains how to add, delete and grant Sudo privileges to users in Ubuntu Linux operating system. The guide is officially tested on Ubuntu 26.04, 24.04, and 22.04 LTS editions. While this guide is written exclusively for Ubuntu Linux, the steps to create sudo users are same for other Ubuntu-based distributions such as Linux Mint or Pop!_OS. Before getting into the topic, allow me to explain what exactly sudo is and its benefits. Table of Contents
1. What is Sudo? In Linux and Unix operating systems, there is a special user called – root . The root user can do anything and everything in a Unix-like system. Using root user for the day to day activities can be dangerous and it is not recommended. One wrong command can destroy the whole system! This is where the “sudo” comes in help. Sudo allows the authorized users to perform tasks with root-level privileges, even if they don’t know the root user password. This is why it is important to create a regular user and add him to sudo user group to perform administrative tasks. Hence, this user can act as both regular user and administrative user when running commands prefixed with sudo. 2. Benefits of Being Sudo You don’t have to share the root password with other users. The users’ need not to know the root user password to perform administrative tasks. When doing an administrative task, the users will be prompted for the sudo password before any changes can happen in the system. It should make the users to think about the consequences of what they are doing. The admin rights can be easily granted to the users and revoked at any time if they no longer required. Some Linux distributions, for example Ubuntu, disables the root user by default. So there is no way to launch brute-force attacks on the root user. Even if someone try, it would be pointless. Because there is no root password to crack. More importantly, the sudo session will be timed-out after a short period. Just in case if you left the terminal open after running some commands with sudo permission, the authentication automatically expires. Hence, the other users can’t do any further administrative tasks. By default, the sudo password is remembered for 15 minutes in the current session. After that, you need to enter the password again. You can monitor the sudo users’ command line activity. sudo adds a log entry of the commands run by the users in /var/log/auth.log file . If there is a problem, you can look into those commands and try to figure out what went wrong. These are a few advantages of being a sudo user. Now, let us go ahead and see how to add, delete and grant Sudo privileges to users in Ubuntu Linux. First, we will create a regular user. 3. Add New User in Ubuntu Linux First, let us create a regular user, for example “senthil” . To do so, run: $ sudo adduser senthil Replace “senthil” with your own username. Sample output: New password: Retype new password: passwd: password updated successfully Changing the user information for senthil Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y Create a New User in Ubuntu Linux We just created a new user called “senthil”. This user has not been given sudo access yet. So he can’t perform any administrative tasks. You can verify if an user has sudo access or not like below. $ sudo -l -U senthil Sample output: User senthil is not allowed to run sudo on Ubuntu2604. Check if an User has Sudo Access in Ubuntu Linux 4. Grant Sudo Privileges to Users in Ubuntu Linux Add the newly created user to sudo group using the following command: $ sudo adduser senthil sudo Grant Sudo Privileges To Users In Ubuntu 26.04 Linux We granted sudo permission to the user “senthil”. You can also the following command to add a user to sudo group. $ sudo usermod -aG sudo senthil To verify if the user is added in the sudo group, run: $ sudo -l -U senthil Sample output: User senthil may run the following commands on Ubuntu2604: (ALL : ALL) ALL Verify if an User is Added to Sudo Group in Ubuntu Linux Here, the “(ALL : ALL) ALL” line means that the user has unlimited privileges and can run any command on the system. In our case, the ” senthil ” user has been added to the sudo user group . From now on, he can perform all sort of administrative tasks. If you open the contents of the sudoers file; $ sudo cat /etc/sudoers You would see some lines like below. # User privilege specification
root ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on “@include” directives:

@includedir /etc/sudoers.d As you can see in the above output, all members of the sudo group can execute any command. The first ALL is the users allowed. The second ALL is the hosts. If you distribute the same “sudoers” file to many host computers, the user can do administrative commands on all hosts. The third one is the user as you are running the command. The last one is the commands allowed. Note: In some Linux systems, for example Arch Linux, you need to install “sudo” package before creating a new sudo user. # pacman -S sudo On Debian: # apt install sudo On Ubuntu desktop and server editions, “sudo” is installed by default. 5. Verify Sudo Users To verify if the user can able to perform administrative tasks, log out and log back in as the new user. Alternatively, you can instantly switch to another user, without having to log out from the current session, like below. $ sudo -i -u Example: $ sudo -i -u senthil We switched to the user “senthil”. Now, run any commands with prefix “sudo” like below. $ sudo apt update Verify Sudo Permission for an User Yes, the user “senthil can able to run administrative commands with sudo privileges. 6. Delete Sudo Access From Users You can remove sudo permissions from a user without having to delete him/her completely. Caution: You must be careful when doing this in Ubuntu systems. Do not remove the real administrator from the “sudo” group. There should be at least one sudo user in the system. First, make sure you’re logged out from the user “senthil” session and logged in as another sudo user. To revoke sudo permissions from a user (E.g. senthil), the command would be: $ sudo deluser senthil sudo The above command will remove the user called “senthil” from the “sudo” group. Please note that this command will only remove the user ‘senthil’ from the sudo group, but it will not delete the user permanently from the system. Alternatively, run the following command to revoke the sudo permission from the user: $ sudo gpasswd -d senthil sudo Now, the user becomes a regular user and can’t do any administrative tasks with sudo permission. To verify if the user has really been removed from “sudo” group, run: $ sudo -l -U senthil Delete Sudo Access from an User in Ubuntu Linux The sudo permission has been removed from the user. 7. Delete Users Permanently In the above step, we have only removed the users from the “sudo” group. But the user still exists in the system. To remove a user completely from a Linux system, log in as root or sudo user and run: $ sudo deluser Example: $ sudo deluser senthil If you want to remove a user along with their home directory and mail spool, run: $ sudo deluser –remove-home senthil For more details, check man pages for adduser , deluser and sudo commands. $ man adduser $ man deluser $ man sudo This guide is also available for other Linux distributions. Check the following guides to add, delete and grant sudo privileges to users in Alpine Linux, Arch Linux, CentOS and Fedora Linux distributions. Add, Delete And Grant Sudo Privileges To Users In Alpine Linux Add, Delete And Grant Sudo Privileges To Users In Arch Linux Add, Delete and Grant Sudo Privileges to Users in Debian 13 and 12 Add, Delete And Grant Sudo Privileges To Users In CentOS Add, Delete And Grant Sudo Privileges To Users In Fedora Add, Delete, And Grant Sudo Privileges To Users In RHEL, AlmaLinux And Rocky Linux 8. Cheatsheet Here is a cheatsheet for granting sudo privileges for users in Ubuntu Linux. Download it and keep it near your desk for quick reference. Cheatsheet – Add, Delete And Grant Sudo Privileges To Users In Ubuntu 9. Conclusion In this detailed tutorial, we looked at several important things about sudo. First, we gave you a brief introduction to sudo and its benefits. Then we discussed how to add, delete and grant sudo privileges to users in Ubuntu 26.04 LTS operating system. Finally, we saw how to revoke the sudo permission and how to delete the user permanently. Even though, it is specifically written for Ubuntu, this method is quite same for other Ubuntu-based and DEB-based systems. Related Read: How To Change Sudo Password Timeout In Linux How To Change Default Sudo Log File In Linux How To Restore Sudo Privileges To A User How To Find All Sudo Users In Your Linux System How To Run Particular Commands Without Sudo Password In Linux
Add sudo user Add user Delete Sudo Privileges Delete User grant sudo privileges Jammy Jellyfish Linux Linux commands Linux howto Linux user management Ubuntu Ubuntu 22.04 LTS Ubuntu 24.04 LTS Ubuntu 26.04 LTS
0 comments

13
Facebook Twitter Linkedin Reddit Whatsapp Telegram Email
sk Senthilkumar Palani (aka SK) is the Founder and Editor in chief of OSTechNix. He is a Linux/Unix enthusiast and FOSS supporter. He lives in Tamilnadu, India.

Previous post
Docker Releases Mitigation for Copy Fail (CVE-2026-31431)

Next post
What Is WP-CLI and Why Every WordPress Pro Uses It (2026)
You May Also Like

VirtualBox error – Kernel driver not installed (rc=-1908)
Published: March 8, 2016

Ubuntu 26.04 LTS Resolute Raccoon Beta is Released:…
Published: March 27, 2026

How To Add ‘New Document’ Option In Right…
Published: July 24, 2019

Turn Your Favorite Websites Into Desktop Apps Using…
Published: December 4, 2023

Convert Ubuntu Into Rolling Release Using Rolling Rhino
Published: June 30, 2020

How To Create Persistent Live USB Using Mkusb…
Published: October 9, 2019 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment. * By using this form you agree with the storage and handling of your data by this website.
Δ This site uses Akismet to reduce spam. Learn how your comment data is processed.

**Source:** [ostechnix.com](https://ostechnix.com/how-to-add-delete-and-grant-sudo-privileges-to-users-in-linux/)
**Feed ID:** 3

About The Author

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *