Objective

By default the regular user does not have an ability to execute commands with root privileges. As a result the following message will appear:
$ sudo -i
[sudo] password for linuxconfig: 
linuxconfig is not in the sudoers file.  This incident will be reported.
redhat 7 user not in sudoers file
The objective is to gain a superuser ( root ) access on Redhat 7 Linux server using sudo command.

Requirements

Privileged root access to your Redhat 7 Linux server installation.

Difficulty

EASY

Conventions

  • # - requires given command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given command to be executed as a regular non-privileged user

Instructions

Add user to WHEEL group

Using your current shell or log in as a root user execute the following command to add any user you wish to grant a sudo access. The example below will give a sudo access to linuxcofnig user:
# usermod -G wheel linuxconfig

User logout

If you attempt to execute the sudo command now, you will still get the above error message unless you completely logout your user and re-login again:
$ exit
If you are using GUI interface, the quickest way to apply the above changes is to logout and login from your graphical manager.

Executing command with sudo

Once you re-login you will be able to execute command as a privileged user:
Using sudo command privileged user redhat 7 linux