How to give any group all privileges like root in sudoers file.

Allow a group all root privileges in sudo file.

Let’s first check the members of group using following command and then apply root privileges.
  • #tail /etc/gshadow


[root@linuxelearn ~]# tail /etc/gshadow
nagios:!::
nagcmd:!::apache
rahul:!::
ram:!::pooja
rpgroup:!:nagios:rahulp,pooja
ktg:!::
admin:!::
pooja:!::
linuxelearn1:!::
rjgroup:!::nagios
[root@linuxelearn ~]#


To give root privileges to group add a line by using sudoers file as shown below.
  • Type Command VISUDO to open sudoers file.
  • #visudo (save the sudoers file as we save a vim file using “wq!”)


## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL
%rpgroup      ALL=(ALL)       ALL
 
## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

  • Now, login as one of the user of rpgroup try root commands


[root@linuxelearn ~]# su pooja
[pooja@linuxelearn root]$ cd

[pooja@linuxelearn ~]$ sudo fdisk -l

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for pooja:

Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000efa3d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1301    10240000   83  Linux
/dev/sda3            1301        1562     2097152   82  Linux swap / Solaris
/dev/sda4            1562        2088     4228884    5  Extended
/dev/sda5            1562        1626      517837+  82  Linux swap / Solaris
/dev/sda6            1627        1691      522081   8e  Linux LVM
/dev/sda7            1692        1756      522081   8e  Linux LVM
/dev/sda8            1757        1821      522081   82  Linux swap / Solaris
[pooja@linuxelearn ~]$


This is all about group root privileges.


I hope you like this article…


Post a Comment