What Is Sudo Exactly

What is sudo and why is it so important?

If you have a Linux server, you have definitely faced to use Sudo command or not when installing something or doing anything in your Linux VPS. Sudo is used to perform commands with the privileges of another user.

Do You Have To Use Sudo To Run Your Commands?

In this article, I will simply this. If you are using a Root user, it means you have access to all parameters in your Linux server, and you don’t need to use Sudo before each command you write. If you are not using the Root user, this can have two meanings.

  1. If your user is inside the Wheel group, you can use Sudo before each command to perform administrative tasks.
  2. If your user is not in the Wheel group, you cannot perform administrative tasks.

What Is Wheel Group?

Only the users inside this group can execute commands with the Sudo command. The Root user is inside the Wheel group.

What Is The Difference Between Su And Sudo Commands?

Su command is used to switch between users in a Linux system where Sudo command is used to execute commands as the administrator of the Linux system.

Should I Use Root User In My Linux Server?

It is not safe to perform commands as a Root user inside Linux servers. Instead, it is better to have a different user in Your Linux VPS Server with root privileges.

In this situation, you will have to use Sudo before each command that you perform.


$ sudo install nano

Disable Password For Sudo

It is not always easy to do this on each command that you perform because you will be asked to enter your password every time. To fix this, we will add a line in the Sudoer file, and then you will no longer have to enter the password each time you use Sudo.

Login to your Linux VPS Server with the Root user and open the Sudoer file using the following command.

# visudo

Press Enter button to be able to type and press I to be able to insert the command. Add the following line to any free line and remember to put your username instead of the username parameter.

username     ALL=(ALL) NOPASSWD:ALL

Press Esc, type :wq and press Enter to save your modifications.

Edit Sudoer file in Linux

If you are still having trouble with sudo, you can refer to our troubleshooting guide about sudo command not found error.

How To Create A User With Root Privileges?

I create the user john, instead of john, write your own username.

Use the following command to add a user.

# adduser john

The user is now created. Use the following command to add the user to the Wheel group to have Root privileges.

# usermod -aG wheel john

Use the following command to switch to user john. The first time, you will have to set a password for the new user.

# su john

You can also use the same command to switch to the Root. If you also want to remove the user from the Wheel group, you can use the following command.

# gpasswd -d john wheel

Here is what Sudo is. I hope I have explained well and in easy English about what Sudo exactly is. If you have any questions, please do not hesitate to ask in the comments section.

Leave a Reply

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