Running as non-root user
Brought to you by:
nickgiles
I'm moving from crontab to Fat Controller for running a PHP task queue script. The script creates lots of files etc, and I need it to be run as a specific user.
Starting /etc/init.d/fatcontrollerd requires me to be root, and then runs the script as root.
Is there a way to have the PHP script run as a specific user?
Hello.
Sorry for not replying sooner.
I don't see any problem with running the Fat Controller as a non-root user. You will just have to make sure that the permissions on the PID file and log file are set so the user can read and writeto them. Also, you will need to remove the following from fatcontrollerd:
if [ `id -u` -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
Another way to do it would be to wrap your call to PHP using sudo so that it is run as another user. I've not tried it, but it should work:
http://linux.die.net/man/8/sudo