I currently running a websever with Nginx+PHP-Fpm and each sites on its own username/GID. Then I have a bash script that I use to create new user along with other necessary stuffs. I know I can call a script using shell_exec/suexec but I am wondering what is the safest way to call a bash script without jeopardizing the security of the server?
At first I was thinking of setting a cron job to run the script but the account need to be up instantly. So cron not gonna work.
Also I've done some searching and some suggest to use php daemon to monitor a queue then run the the script when there's a job. Not really sure about this (daemon) since I never have any experience on it.
How I can run my script safely?
Just to update that I've decided to go with Beanstalkd + pheanstalk combination.
Php script will send the job to queue and it then will be run by a daemonized php script run by a seperate user that has privileges needed.