You are not logged in.
I have a headless device for which I would like to use a web page to reboot, shutdown, etc. I have done this before with both a debian and Arch i686 implementation. I am trying to re-create this in Arch x86_64, but have not had much luck. I am using nginx with php. I have tried rebooting and shutting down directly from a web page using both exec and shell_exec but am getting permission errors relating to user html no matter which approach I take.
In sudoers, I have tried both of the following lines (oviously not at the same time):
http ALL=(ALL) NOPASSWD: ALL
http ALL =NOPASSWD: /usr/sbin/systemctl shutdown,/usr/sbin/systemctl reboot
journalctl reveals the following whenever I try to execute any system command using php in an html page.
Dec 30 20:35:57 splayer sudo[574]: pam_unix(sudo:auth): auth could not identify password for [http]
Dec 30 20:36:40 splayer sudo[587]: pam_unix(sudo:auth): auth could not identify password for [http]
Dec 30 20:37:04 splayer sudo[596]: pam_unix(sudo:auth): auth could not identify password for [http]
It doesn't seem to matter if I try and execute a command directly from a web page or via a bash script since I get the same error either way. And it only seems to effect commands like reboot, shutdown or something requiring systemctl.
My guess is it is a simple permission setting that is causing the problem, but it seems like the first sudoers command above should allow http to execute all commands without a password.
If additional information helps, I would be happy to supply it.
Any help would be greatly appreciated since I have spent two days on this already.
- Jim
Last edited by jsalk (2015-12-31 15:56:02)
Offline
Offline