List sudo users in centos
How do I list all sudo users at CentOS server?
There are many groups(root, wheel, adm etc) at server, and have users in it. I am looking an easy way/command to find users in all groups who have sudo access.
Note: My user also have sudo access. And I am using 64-bit CentOS release 5.2 (Final).
Try this:
for USER in `cut -d: -f1 /etc/passwd`
do
sudo -U $USER -l
done
What is wrong with sudo cat /etc/sudoers
and maybe getent group <groupname>
to get usernames of group members?
When adding users with sudo permissions on centos7
, its advised to add them to the wheel
usergroup which by default has sudo permissions with
sudo gpasswd -a <user_name> wheel
Following @Sven 's answer, does the trick for centos7
.
getent group wheel