“sudo is a program for Unix-like computer operating systems that allows users to run programs with the security privileges of another user”
And we are going to use the same program to assign a user the right or access permission to shutdown or reboot a CentOS based computer system.
Steps to allow non-root non-admin user to shutdown or reboot a CentOS system:
- Login as root in the terminal
- Create a new group on Centos named ‘developers’ or you may assign the right to an existing group as well.
- Install Sudo by using the command: $ yum install sudo
- Now edit the sudo configuration using the command: $ visudo
- Look for some thing like ‘# %users localhost=/sbin/shutdown now’
- Press ‘i’ or insert keyboard button of your keyboard to start editing the config file
- Below the above line add the following lines:
- %developers ALL=/sbin/shutdown now
- %developers ALL=/sbin/reboot
-
now save the config file by doing:
- press ‘Esc’ keyboard button
- then type without quotes: “:wq!”
- Hit return key
And you are done!
Now any user of the group ‘developers’ will be able to shutdown the system using the following command
$ sudo shutdown now
To reboot:
$ sudo reboot
Comments are closed.