[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] How to install crontab form php-script



"Jens Peter Möller" <jpm@xxxxxxxxx> wrote:
> I have a php script, witch creates
> a text file and then executes the
> system command "crontab", to install
> the crontab from this text file.
>
> It works, but php(apache-modul) runs as
> "httpd" and installs the crontab for "httpd".

Install a second copy of PHP as a CGI.  Then use a separate file extension
for this version of PHP and make your script owned by root so it runs as
root.

> I wan't to install individual crontabs
> for other users. OK, I can do "crontab -u username",
> but this works only as root.
>
> How can I solve this problem?
> Or, how can I allow "httpd" to run
> "crontab -u username"?

A user has to be in /etc/cron.allow to be able to execute crontab.  I think
only root can execute crontab with the -u flag, but even if this wasn't the
case this strategy would be a serious security risk if you have other
non-trusted users on the server.  If you choose not to add PHP as a CGI, why
not have PHP write the crontab command to a file and setup a crontab for
root to periodically check the file and run the contents of it as shell
commands?  That's the easiest solution I can think of.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/