php 执行root权限命令无效的问题,webCGI执行root命令权限的问题

apache错误日志 sudo: no tty present and no askpass program specified 问题,
failed: Operation not permitted 问题
cgi执行root命令的权限问题
vim /etc/sudoers
将 Defaults requiretty
改为#Defaults requiretty
注释掉
增加一行
httpd(web用户) ALL=(ALL) NOPASSWD:ALL
php执行命令前面加上sudo
shell_exec('sudo /sbin/mii-tool')
shell cgi程序
echo -e "Content-type: text/html\n\n"
echo "Hello, World."
for re in `sudo /sbin/mii-tool`
do
echo $re;
done


猜你喜欢

转载自blog.csdn.net/abc595951988/article/details/80320132
今日推荐