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
5 Steps to Create a New Sudo User:
1. Login to your server
First of all, connect to your Linux server via SSH
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.
# adduser newuser Adding user `newuser' ... Adding new group `newuser' (1001) ... Adding new user `newuser' (1001) with group `newuser' ... Creating home directory `/home/newuser' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for newuser Enter the new value, or press ENTER for the default Full Name : New User Room Number : 101 Work Phone : 123456 Home Phone : 123456 Other : Is the information correct? [Y/n] y
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:
# apt-get install sudo
You can verify that it is successfully installed using this command:
# dpkg -l | grep -i sudo
The output should be similar to the one below:
# dpkg -l | grep -i sudo ii sudo 1.8.16-0ubuntu1.3 amd64 Provide limited super user privileges to specific users
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.
# deluser newuser sudo Removing user `newuser' from group `sudo' ... Done.
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.