cannot reboot from a script ran by root's crontab

Dean Strik dean at stack.nl
Thu Jun 12 10:17:07 PDT 2003


PsYxAkIaS (FreeBSD) wrote:
> Hello
> 
> $ cat /usr/sbin/checkre
> #!/bin/bash

You have a /bin/bash?
Use /bin/sh instad.

> mkdir /tmp/reboot
> reboot now

> $ crontab -l 0,5,10,15,20,25,30,35,40,45,50,55 * * * *
> /usr/sbin/checkre >/dev/null 2>&1
> 
> $ whoami root
> 
> when the time comes, it makes the directory /tmp/reboot  but it doesnt
> 'reboot now'.
> 
> 
> Is this a security issue that forbids FreeBSD to reboot from a script
> running by root's crontab? if yes, how can i bypass it?

The reboot binary is in /sbin. Which is not in your PATH.
Either set PATH in the crontab, or edit the checkre script to use
/sbin/reboot instead.

Root should have the errors in it's mail btw...

-- 
Dean C. Strik             Eindhoven University of Technology
dean at stack.nl  |  dean at ipnet6.org  |  http://www.ipnet6.org/
"This isn't right. This isn't even wrong." -- Wolfgang Pauli


More information about the freebsd-isp mailing list