【发布时间】:2013-11-03 23:37:47
【问题描述】:
我只想使用具有 root 权限的 php 脚本和像 tutorial 这样的 C 包装器。
ls -l :
-rwsr-xr-x. 1 root root 6466 Aug 15 03:07 createConfig
-rwxrwxrwx. 1 root root 102 Aug 15 04:23 test.php
-rw-r--r--. 1 root root 822 Aug 14 21:35 index.php
createConfig.c:
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main(void) {
system("/usr/bin/php /var/www/html/test.php");
return 0;
}
test.php:
<?php
mkdir("/root/ourDir");
?>
index.php:
<?php
exec("/var/www/html/createConfig");
?>
但是当在浏览器上运行 index.php 时我得到了这个错误:
sh: /var/www/html/createConfig: Permission denied
谢谢
【问题讨论】:
-
Basile,有例子吗?我已经尝试过它们,但并没有完全奏效。参数未正确传递和其他问题....很久以前就记住了