sudo in php exec()

后端 未结 7 1240
执笔经年
执笔经年 2020-11-22 09:44

I don\'t know what the deal is here…

So I want to run an applescript: sudo osascript myscript.scpt

This works fine in the terminal, but not when

7条回答
  •  耶瑟儿~
    2020-11-22 10:24

    I think you can bring specific access to user and command with visudo something like this:

    nobody ALL = NOPASSWD: /path/to/osascript myscript.scpt
    

    and with php:

    @exec("sudo /path/to/osascript myscript.scpt ");
    

    supposing nobody user is running apache.

提交回复
热议问题