CentOS / Red Hat: Sudo Allows People In Group Admin To Run All Commands

CentOS / Red Hat: Sudo Allows People In Group Admin To Run All Commands

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:

  1. Open the sudoers file:

  2. Run the following command to open the sudoers file in the visudo editor:

‮r‬efer to:lautturi.com
sudo visudo
  1. This will open the sudoers file in the vi editor.

  2. Add a sudo group definition:

  3. 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
  1. This will allow members of the admin group to run all commands using sudo.

  2. Save the sudoers file:

  3. Press Esc to exit edit mode, then type :wq and press Enter to save the sudoers file and exit the editor.

  4. Add users to the admin group:

  5. To add users to the admin group, you can use the usermod command. For example, to add the user john to the admin group

Created Time:2017-10-27 14:56:37  Author:lautturi