How to modify privileges of normal user as ‘root’

ROOT is an administrative account without the restrictions that are present on normal users. Users can execute commands with “super-user” or “root” privileges in a number of different ways. There are few commands to switch user to “privileged-as-root” account.

$sudo useradd ramesh

[sudo] password for sadmin: xxxxxxxxxx

sudo – is a command configured through a file in /etc/sudoers

$sudo visudo

[sudo] password for sadmin: xxxxxxxxxx

#Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
–if we want to provide full root privileges to specific user, we can specify as below

sadmin ALL=(ALL:ALL) ALL

(2) SUDO is a group, having full administrative privileges, if we add any user to this group, it will get full administrative powers

$sudo usermod -aG sudo
#example., $sudo usermod -aG sudo sadmin

(3) Alternatively, we can also use below command

$sudo gpasswd -a sadmin sudo

On CentOS, we can add users to wheel group, which is having super privileges

$sudo gpasswd -a sadmin wheel

 

 

Advertisements