How To Create a Super-User Account on CentOS 7

Introduction

The root in a Linux environment is the administrative user and has very broad privileges. With the power comes responsibilities, and this is why it is generally discouraged to use the root-user for performing every-day tasks on your system, or to run programs and services, as this exposes the system to more severe threats If anyone were to gain control over this user.

What we’re going to do is create a new user with standard privileges, and add this user to the super-user group. This enables the user to execute commands with root privileges by prefixing the commands with sudo.

Creating the new user

While logged onto your system as root, we’re going to add the new user. This example creates a new user called “bob”, you will need to replace this with the name you want to give the user:

adduser bob

Next, we will need to assign a password to our newly created user. Again, replace “bob” with the name you supplied upon creation of the user:

passwd bob

When you are requested to, enter a strong password for the user and repeat it again to verify it.

Adding root privileges

To add root privileges to our account, we need to add it to the “wheel” group, which by default on CentOS 7, gives the user access to the sudo command:

gpasswd –a bob wheel

Now your user should be able to execute commands with root privileges.