By default, new user accounts do not have access to use sudo command on a CentOS system. You have to manually add the users or their user group to the ‘/etc/sudoers file’. I do this as follows:
- nano -w /etc/sudoers
- Scroll down to the section ## Allow root to run any commands anywhere
- Below the root entry line I enter: blogchampion ALL=(ALL) ALL
- Save
User ‘blogchampion’ now has access to use the sudo command.
You can also add all users within a particular user group to have sudo permissions. I do this as follows:
- nano -w /etc/sudoers
- Scroll down to the section ## Allows people in group wheel to run all commands
- Below the %wheel entry line I enter: %bloguser ALL=(ALL) ALL
Now all users belonging to the bloguser user group have access to use the sudo command.
You probably also want to force users to use the root password when using sudo. See the post How to make CentOS ask for the root password with sudo for instructions.