How to give root privileges to a user in linux 2020
Here in our website we regulerly update windows computer related computer tips and tricks In this guide, we will show you how to create a new user with sudo access on Ubuntu systems. Then you can use this user account to execute administrative commands without having to log in to your Ubuntu server as root user. How to give root privileges to a user in linux.
How To Create a Sudo User on Ubuntu
The sudo command is designed to allow users to run programs with the security privileges of another user, by default the root user.
Steps to Create a Sudo User
Follow the steps below to create a new user account and give it sudo access. If you want to configure sudo for an existing user, skip to step 3
1. Log in to your server.
Log in to your system as the root user:
2. Create a new user account.
Create a new user account using the
adduser command. Don’t forget to replace
username with the user name that you want to create:
You will be asked to set and confirm the new user password. Make sure the password for the new account is as secure as possible.
Adding user `username' ... Adding new group `username' (1001) ... Adding new user `username' (1001) with group `username' ... Creating home directory `/home/username' ... Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully
Once you set the password, the command will create a home directory for the user, copy various configuration files to the home directory, and ask you to configure the information for the new user. If you want to leave all this information blank, press ENTER to accept the default values.
Changing the user information for username 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]
3. Add the new user to the
By default on Ubuntu systems, members of the sudo group have access to sudo. To add the user you created to the sudo group, use the usermod command:
usermod -aG sudo username
Test the sudo access
Switch to the newly created user:
su - username
sudo to run the
Is the user have sudo access then the output of the
whoami command will be “root”:
How to use sudo
To use sudo, simply prefix the command with
sudo and space:
sudo ls -l /root
The first time you use
sudo in a session, you will be prompted to enter the user password:
[sudo] password for username:
You have learned how to create a user with sudo privileges. You can now log in to your Ubuntu server with this user account and use sudo to run administrative commands.
Also Read : Computer Tips and Tricks 2020