PHP Exec sudo安装抛出奇特的错误消息

时间:2019-05-24 07:49:02

标签: php unix centos

我正在使用Centos7操作系统,我有这个脚本可以从Windows PC挂载文件夹

exec('sudo mount -t cifs -o username="'.$user.'",password="'.$pass.'",dir_mode=0777,file_mode=0777 
//'.$ip_address.'/c/kitpos/update /mnt 2>&1',   $output, $results);

我得到了一条看似权限问题的错误消息。

Array
(
    [0] => 
    [1] => We trust you have received the usual lecture from the local System
    [2] => Administrator. It usually boils down to these three things:
    [3] => 
    [4] =>     #1) Respect the privacy of others.
    [5] =>     #2) Think before you type.
    [6] =>     #3) With great power comes great responsibility.
    [7] => 
    [8] => sudo: no tty present and no askpass program specified
)

我的/ mnt文件夹所有权和许可权是root777,但是即使我将它更改为运行PHP的www-data:www-data,仍然出现相同的错误。

777 drwxrwxrwx 2 root root 4096 mnt

我也有一个Ubuntu服务器,但是在使用相同代码的情况下,它可以正常工作。有人有主意吗?

0 个答案:

没有答案