how to do a linux reboot from php file

前端 未结 7 2045
忘掉有多难
忘掉有多难 2020-12-19 10:53

I have a user brftv on my linux system and I have www-data that runs the nginx.

from the terminal I can let my brftv user run

sudo /sbin/reboot
         


        
7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 11:34

    Why did you put -u brftv in there? That makes your PHP script try to run the reboot as your user, which won't work. Only root can reboot the system. Remove it.

提交回复
热议问题