How to Add User to Sudo Group on Ubuntu 24.04

Sudo Group on Ubuntu

When you fresh install Ubuntu 24.04 and create a user, that user is added to sudo group by default. Because you need sudo privileges to perform different administrative tasks. What about new users you create later after successfully installing Ubuntu? You need to manually add them to sudo group if you want that user to perform administrative tasks.

There are many ways you can use to add a user to sudo group. In this article, we will look into them one by one.

How to Add User to Sudo Group on Ubuntu 24.04

Method 1. Using command line or terminal 

Launch the terminal from Show Apps or using shortcut key CTRL + Alt + T.

1. Usermod command

You can use usermod command to add a user to sudoers. The command has the below syntax.

sudo usermod -aG sudo username

We have a user ‘ted’ that we want to assign administrative privileges. We need to make him a part of sudo group by using the following command.

 sudo usermod -aG sudo ted

Let’s briefly explain what the command did. Usermod is used for modifying the existing user in Linux, a means append or add and G means group. So, the command has modified the existing user ‘ted’ and added him to sudo group.

2. Adduser command

The next command that you can use is adduser. It has the following syntax.

sudo adduser username sudo

We have a user ‘tony’ that we want to add to sudo group. The command to be executed will take the following form.

sudo adduser tony sudo

Make sure the user already exists for this command to work.

You can verify this operation by executing the following command. This will return all the groups ted belongs to.

groups ted

Method 2. Using Graphical User Interface (GUI)

Step 1. Open the settings. Search settings in the menu bar.

Step 2. Search users in the settings and click on it when found.

Step 3. For security, some of the settings are locked. You need to unlock it. Click Unlock… Provide your password and then click Authenticate.

Step 4. Choose the user you want to assign sudo privileges and click on it.

Step 5. Toggle the administrator button as shown in the following screenshot.

You can verify if the user is added to sudo group, Login with your username and execute any command with sudo privileges.

Conclusion

That’s all. You can use either a terminal or GUI to assign user a sudo group. You can use GUI for desktop version while you can use the terminal for both desktop and server versions.