How to disable “sudo su -” and “sudo passwd root” commands for wheel group users.

How to disable “sudo su -” and “sudo passwd root” commands for wheel group users.

Date: 02-10-2021

Step 1: Create user name and password.
# adduser pheonix
# passwd pheonix

Note:- pheonix – Username

Step 2: Add the user to the wheel group.
# gpasswd -a pheonix wheel

Step3: Open the sudoers configuration file.
# vim /etc/sudoers

Change

%wheel  ALL=(ALL)    ALL   

to  

%wheel  ALL=(ALL)    !BLOCKSU

Step 4: Save and exit the file. You can run the below commands in wheel user to verify. You will get an output like the below screenshot.
#sudo su-
#sudo passed root

Thank you!

LEAVE A COMMENT