I'm trying to run at
command via PHP
<?php
shell_exec("echo \"php /tmp/skript.php `whoami`\" | at now");
echo shell_exec("atq 2>&1");
output:
247 2016-07-14 11:30 = apache
But the command at
is not executed and after this, and the time disappear from the queue.
I'm running Cent OS on my production server. (SELinux is disabled)
When I'm running this on my personal computer with Debian, everything works well. (SELinux disabled here too)
The permissions are OK:
bash-4.1$ ls -l /tmp/skript.php
-rwxrwxrwx 1 admin admin 741 13. čec 08.16 /tmp/skript.php
When I execute the shell as apache
me@PC:~$ sudo -u apache /bin/bash
bash-4.1$ echo "php /tmp/skript.php `whoami`" | at now
script will be executed as apache
When I do this:
me@PC:~$ sudo usermod -s /bin/bash tom
everything works, but this is BAD and not the way I would like to do. This is not an answer/solution for me.
My Debian has apache as shell /bin/nologin too and it's working. Also at.deny
is empty and at.allow
doesn't exist.
Can somebody answer this tricky question?