In CentOS 6.5, i would do the following to setup sudo for users -
- useradd -G wheel -c "John Smith" jsmith
- uncomment this line - %wheel ALL=(ALL) ALL
- usermod -G wheel -a jsmith
- restart sshd - /etc/init.d/sshd restart
- ssh login as jsmith and type 'sudo bash'
When i try the same thing in CentOS 7, i see the following in /var/log/secure -
Oct 8 05:20:00 localhost sudo: jsmith : user NOT in sudoers ; TTY=pts/1 ; PWD=/home/jsmith ; USER=root ; COMMAND=/bin/bash
Is this procedure not valid for CentOS-7 anymore?
More info -
file /etc/group has this -
visudo shows this -
## Allow root to run any commands anywhere root ALL=(ALL) ALL ## Allows members of the 'sys' group to run networking, software, ## service management apps and more. # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS ## Allows people in group wheel to run all commands wheel ALL=(ALL) ALL ## Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL
output of sudo -l command -
[jsmith@localhost ~]$ sudo -l [sudo] password for jsmith: Sorry, user jsmith may not run sudo on localhost. [jsmith@localhost ~]$