shutdown machine from crontab

Ed Greshko ed.greshko at greshko.com
Wed Sep 16 22:45:03 UTC 2015


On 09/17/15 06:37, Antonio Olivares wrote:
> From your message Ed, I get that I would need to type a password, but if I issue the command(s) from terminal the machine shuts down and does not prompt me for anything.  I was thinking also about /etc/cron.deny but one can do pretty much anything most were working except shutdown

Yes, the crontab entry for a normal user is failing since a password is needed.  A GUI session is treated differently than a login-terminal session and a terminal-less environment such as when executing a crontab.  A "security" feature of sorts to prevent someone who doesn't have root access to power off the machine remotely while others may be using it.

The path of least resistance is to do as you did and use root's crontab.  The alternative being to use your own crontab but call poweroff from "sudo" and configure it such that a password isn't needed.  But that would require extra work which is, IMHO, not worth it when you can simply use root's crontab.  :-) :-)

-- 
It seems most people that say they are "done talking about it" never really are until given the last word.


More information about the users mailing list