How to Add a User to Sudoers Group in Rocky Linux / CentOS

Using root user is not recommended. To allow users to behave like root you can add them to the sudoers group. For CentOS / Rocky Linux, this group is called wheel. Strange, isn't it? Why not sudo? Well, it's wheel and that's it.

To add the user to the sudoers group (as root)

usermod -aG wheel username

If it doesn’t work yet, edit the /etc/sudoers file (as root) using visudo

visudo

Uncomment this line (there should be two similar lines for wheel, make sure to uncomment this one and not the other one). Remove the # if it is there (do not remove the %)

%wheel ALL=(ALL) ALL

You can sudo now!

If you are looking to add your user to the Sudoers Group in Ubuntu/Debian, here is how to do it.

Leave a Reply

Your email address will not be published. Required fields are marked *