shutdown script for user in kcron

automatic shutdown is very attempting to try. especially when you leave office earlier than your secretary. and your secretary still work until late and the data is in your computer, but she doesnt know how to shutdown your computer, coz your OS is linux.

1. login as root
2. add yourusername to group wheel… u can do it by simply edit /etc/group
find line wheel and add youruser into the last line like this
wheel:x:10:root,yourusername
3. hange the permission of /etc/sudoers only for now
chmod u+w /etc/sudoers
4. edit /etc/sudoers
nano /etc/sudoers
5. add this line
%wheel ALL= NOPASSWD: /sbin/shutdown
6. save and change the permission again
chmod u-w /etc/sudoers
7. the execute command for any user who want to shutdown is using sudo command like this
sudo /sbin/shutdown -h now

remember to put a complete command line. coz i tried it shutdown than /sbin/shutdown, the command asked for password and gave me an error message that the command wasnt there.

you can put this command into kcron to scheduled as you wish

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.