To revoke sudo privileges from a user, you must remove them from the sudo
group. Below are the methods for different Unix-like systems:
sudo gpasswd -d username sudo
sudo deluser username sudo
These systems often use the wheel
group for administrative privileges:
sudo gpasswd -d username wheel
sudo usermod -G $(groups username | sed "s/ wheel//g") username
sudo usermod -G $(id -nG username | sed 's/\\//g' | tr ' ' ',') username
After removing a user from the group, verify with:
groups username