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




Shell commands in Linux

$echo $HISTSIZE                                     (  — To find out history size, by default it will be 1000)


$echo $USER                                           ( — To find out user logged in)


$echo $BASH                                          (– To find full path name of BASH cmd)


$echo $HISTFILE                                   (– To find file location of history of current user)


$echo $HISTCMD                                (– To find number of history contents of current user)


$echo $MAIL                                         (– To find out location of mail-folder of current user)