免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7299 | 回复: 5

[Ansible] linux 限制了 php 对 shell 的使用? [复制链接]

论坛徽章:
1
丑牛
日期:2014-04-04 17:35:24
发表于 2014-09-22 14:44 |显示全部楼层
本帖最后由 exuxu 于 2014-09-22 14:46 编辑

环境使用 ansible 做多机运维,使用 php 做前端。
  1.           $cmd = 'cd /data/tool && ./time ';
  2.           echo "<br/>";
  3.           exec($cmd,$out,$states);
  4.           print_r($out);
  5.           if( $states == 0){
  6.                     echo '命令执行成功!';
  7.           }else{
  8.                   echo '命令执行失败,请检查相关文件权限问题?';
  9.           }
复制代码

  1. #!/usr/bin/expect -f
  2. set timeout 5

  3. spawn su -c "ps -ef |grep path " celebi
  4. expect "assword:"
  5. send "123321\r";
  6. interact
复制代码
1。权限设置没有问题
   2。ps -ef 在任何普通用户中都能显示一大把内容,为什么apache就不行?
            我尝试把 httpd 服务用户替换成普通 用户, ps -ef 还是没有内容可以显示
所以,我的问题是,  linux 限制了 php 使用 shell 的使用?

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
发表于 2014-09-23 13:19 |显示全部楼层
用root跑httpd可以吗

论坛徽章:
1
丑牛
日期:2014-04-04 17:35:24
发表于 2014-09-23 17:37 |显示全部楼层
回复 2# Shell_HAT


    haha,
  1. Error:\tApache has not been designed to serve pages while\n\trunning as root.  There are known race conditions that\n\twill allow any local user to read any file on the system.\n\tIf you still desire to serve pages as root then\n\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n\tand then rebuild the server.\n\tIt is strongly suggested that you instead modify the User\n\tdirective in your httpd.conf file to list a non-root\n\tuser.\n
复制代码

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
发表于 2014-09-23 18:08 |显示全部楼层
回复 3# exuxu


    这是启动apache的时候的报错吗?哪个版本?

论坛徽章:
1
丑牛
日期:2014-04-04 17:35:24
发表于 2014-09-24 16:00 |显示全部楼层
回复 4# Shell_HAT


    Apache/2.2.15 (Unix)  

论坛徽章:
0
发表于 2014-10-10 16:11 |显示全部楼层
lollollol
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP