Allow group sudo

How to allow users in a group to run all commands in Fedora / CentOS using sudo

This tutorial will guide you on how to allow a group of users to run all the commands without sharing your system root password in Fedora / Redhat / CentOS based Distros.

This is similar to the sudo in Ubuntu. Here we will start by creating a group called “sysadmin”, then we will append a user “chia” to that group which will be able to run any command on the system. Lets start by creating a group and adding a user to it.
[root]# groupadd sysadmin

[root]# usermod -aG sysadmin chia

Now edit the /etc/sudoers. Its possible to edit the file in an editor, but its safer to use visudo instead.
[root]# visudo

Add the following line to the file
%sysadmin ALL=(ALL) ALL

Now you can login as user “chia” and run any command by appending sudo.
[chia]$ sudo ifconfig

You can also gain access to root shell by using password of user “chia”
[chia]$ sudo -s