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

Shell commands in Linux

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

histsize

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

user

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

bash

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

history

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

histcmd

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

mail