How to Create Users and Manage Their Sudo Privileges on Ubuntu

We will show you How to Create Users and Manage Their Sudo Privileges on Ubuntu. The sudo command allows normal users to run programs which are only available to the root user. This tutorial will show you the simplest way to create a new user with sudo access on Ubuntu, without modifying your server’s sudoers file.

5 Steps to Create a New Sudo User:

1. Login to your server

2. Add a new system user

# adduser newuser

Feel free to replace newuser with the name of the system user you want to add. You will need to enter a password for your new user as well as you will need to enter some random user information. You can generate a strong password through the command line.

3. Add sudo privileges to a system user in Linux

Once the system user is created go ahead and add it to the sudo group using the following command:

# usermod -aG sudo newuser

Then, use the su command to switch to the new user:

# su - newuser

Now you can try to run some command or program that is available only to the root user. For example, try to update the package index and to install the newest versions of all packages that are currently installed on your server.

sudo apt-get update
sudo apt-get upgrade

In case the sudo command is not installed on your server you will get the following error:

-su: sudo: command not found

4. Install Sudo program

This means you will need to install the sudo program in order to be able to run that command. Switch to your root account and run the following command:

Once the sudo program is installed on your Ubuntu VPS, switch to the new user and try to run the same commands again. You should not see the error message now and instead, you will be prompted to enter the password of the new system user.

5. Remove sudo privileges for a system user in Linux

In some cases, you may want to remove the sudo privileges for a specific system user. For that purpose you can use this command:

# deluser newuser sudo

Feel free to replace newuser with the name of the system user you want to modify. If you get the following message that means the system user has been successfully removed from the sudo group.

Of course, you don’t have to Create Users and Manage Their Sudo Privileges on Ubuntu, if you use one of our Ultra-Flast VPS Hosting services, in which case you can simply ask our expert Linux admins to Create Users and Manage Their Sudo Privileges on Ubuntu server. They are available 24×7 and will take care of your request immediately.

PS.If you liked this post on How to Create Users and Manage Their Sudo Privileges on Ubuntu, please share it with your friends on the social networks using the buttons below or leave a reply in the comments section. Thanks.