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

By default, CentOS and Red Hat systems are configured to allow users who are members of the “wheel” or “sudo” group to run all commands using the “sudo” command. Here’s how to add users to the “sudo” or “wheel” group:

  1. Log in as root or a user with sudo privileges.
  2. Open the sudoers file in a text editor with the command:
visudo
  1. Find the line that says:
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
  1. Uncomment the line by removing the “#” at the beginning of the line.
  2. Save and exit the file.
  3. Add the user to the “wheel” or “sudo” group using the following command:
usermod -aG wheel <username>
  1. Log out and log back in for the changes to take effect.

Once the user is a member of the “wheel” or “sudo” group, they can use the “sudo” command to run all commands with root privileges. It’s important to be careful when using the “sudo” command and only run commands that you trust, as this can have significant security implications.

Leave a Comment