How to enable sudo on CentOS 8?

Windows Articles

How to Backup your call and SMS history in Android

Many times we find ourselves in the situation of having to change our phone, for different reasons, and one of the questions...

Install and configure Apache Guacamole on Debian 10

Hello, friends in this post, you will learn how to install and configure Apache Guacamole in Debian 10. It will be a...

Ubuntu 20.10 available

The new version of Ubuntu is now available, under the code name "groovy gorilla". Ubuntu 20.10 focuses on improving and refining the...

Monitoring Ubuntu 20.04 with Stacer

Normally if we use Linux on a production server, it is important to monitor it. On the other hand, in everyday use, many users...

How to get the Android 11 Notification Panel

It's no secret that even though Android is the most widely used mobile operating system. Not always our device has the latest...
angeloma
angeloma
Senior Writer and partner

In our CentOS 8 system, it is necessary to execute commands with user privileges. To do this we have a tool from the GNU project called sudo. However, it is necessary that the user of the system has the privilege to use it. So, in this post, you will learn how to enable sudo in CentOS 8. This same tutorial is applicable to Oracle Linux 8 and RHEL 8.

Briefly, What is sudo?

Sudo is a small program or utility that is installed on Linux in order to allow commands to be executed with another user’s security privileges. Usually, this other user is the root user. This causes the regular user to temporarily become a super user.

For the same reason, there are sysadmin who do not like to use sudo, because if it is misused it can lead to a security breach. However, in the end, it is up to the users.

So, let us enable it.

Enabling sudo on CentOS 8

If during the installation of CentOS 8 you have decided not to create any user, then the first step is to create it.

Open a terminal or SSH session and execute the following command:

:~$ su
:~# adduser [username]

Remember to replace [username] with the username of your choice. Then, a password must be assigned.

:~# passwd [username]

Now that we have our user created we can continue. On the other hand, if you have already created the user, you can omit this part.

For the new user to have the sudo command available, it must first be installed. It is usually installed by default but better to be sure.

:~# dnf install sudo

There are now two ways for the new user to use sudo. The first way is to add this user to the wheel group. All members of the wheel group are authorized to use sudo.

If you decide this way, in the terminal use the following command:

:~# usermod -aG wheel [username]

Remember to replace [username] with the username you have chosen.

However, if you do not want your user to belong to the wheel group for any reason, then we will have another option. We can add the user to arcihvo sudoers and specify that they are authorized to use sudo.

To do this as root user open the file /etc/sudoers

:~# nano /etc/sudoers

Then, find this section:

Allow root to run any commands anywhere
root ALL=(ALL) ALL

And add the following:

[username] ALL=(ALL) ALL
1.- Enabling sudo on Centos 8
1.- Enabling sudo on Centos 8

Remember to change [username] to the new user’s username. Save the changes and close the file.

And that is it.

Conclusion

Sudo is a basic utility to run as super users without being one. This is a great advantage in desktop systems or even in certain circumstances on servers. Simply put, it is one of those things that is always good to have on hand.

On the other hand, if you want to learn how to enable sudo in Debian 10, you can do it with this post:

How to enable sudo on Debian 10 Buster?

Please share this post and join our Telegram channel.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to Backup your call and SMS history in Android

Many times we find ourselves in the situation of having to change our phone, for different reasons, and one of the questions...

Install and configure Apache Guacamole on Debian 10

Hello, friends in this post, you will learn how to install and configure Apache Guacamole in Debian 10. It will be a...

Ubuntu 20.10 available

The new version of Ubuntu is now available, under the code name "groovy gorilla". Ubuntu 20.10 focuses on improving and refining the...

Monitoring Ubuntu 20.04 with Stacer

Normally if we use Linux on a production server, it is important to monitor it. On the other hand, in everyday use, many users...

How to get the Android 11 Notification Panel

It's no secret that even though Android is the most widely used mobile operating system. Not always our device has the latest...
x