Shutdown linux machine by non root user
Shutdown/ Reboot linux machine by non root user
01. Create a group testgroup and a user test under this group
# groupadd testgroup
# adduser -G testgroup test
02. Temporarily change permissions of /etc/sudoers, so you have write permission on this file:
# chmod u+w /etc/sudoers
03. Give the the Group and its users permission to execute the shutdown command by editing
/etc/sudors
# vi /etc/sudoers
Add the following Line:
%testgroup ALL= NOPASSWD: /sbin/shutdown
04. Remove the write persmission on /etc/sudoers file
1 / 2Shutdown by Non-Root User
# chmod u-w /etc/sudoers
04. Any user of Group "testgroup" (i.e user test) can shutdown the Linux box by executing
following command
# sudo shutdown -h now
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment