To allow members of the admin group to run all commands using sudo on a CentOS or Red Hat system, you can modify the sudoers file using the visudo command. Here are the steps you can follow:
Open the sudoers file:
Run the following command to open the sudoers file in the visudo editor:
sudo visudo
This will open the sudoers file in the vi editor.
Add a sudo group definition:
Scroll down to the bottom of the file and add a new line to define the admin group as a sudo group. The line should look like this:
%admin ALL=(ALL) ALL
This will allow members of the admin group to run all commands using sudo.
Save the sudoers file:
Press Esc to exit edit mode, then type :wq and press Enter to save the sudoers file and exit the editor.
Add users to the admin group:
To add users to the admin group, you can use the usermod command. For example, to add the user john to the admin group