php - PHP Exec sudo mount 抛出花哨的错误消息
问题描述
我正在使用 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 文件夹所有权和权限是root
,777
但即使我更改它 www-data:www-data 这是我的 php 运行,仍然得到同样的错误。
777 drwxrwxrwx 2 root root 4096 mnt
我也有一个 Ubuntu 服务器,但它在使用相同的代码时运行良好。有人有想法吗?
解决方案
推荐阅读
- javascript - ReactJS:如何将类名添加到子组件
- excel - MS-EXCEL 中的日期格式问题
- c++ - 编译时的派生类发现
- c# - C# 名称“...”在当前上下文中不存在
- keycloak - 如何保护由 keycloak 管理的网站免于滥用“忘记密码”作为向用户发送垃圾邮件的一种方式?
- python - 如何使用箱线图绘制带有散景的分类数据?
- xaml - 如何使工具栏项仅在某些页面中显示
- swift - Swift UITextField 边框扩展
- c# - DataGrid 添加行但文本不可见
- javascript - Angular 6 和 Ionic 3 反应式表单验证错误不显示