Skip to content

Instantly share code, notes, and snippets.

@feldim2425
Last active June 5, 2020 22:19
Show Gist options
  • Save feldim2425/95a938fc6f97511058f802f73a186dec to your computer and use it in GitHub Desktop.
Save feldim2425/95a938fc6f97511058f802f73a186dec to your computer and use it in GitHub Desktop.
# Allows scripts running as www-data (NginX or Apache Webserver) to reboot the machine
#
# Execute "systemctl reboot -i" as a shell command (PHP: shell_exec)
# This policy has been tested on Ubuntu 20.04 Server Version (Policy kit 0.105 which is also used in Debian stretch)
#
# Copy this content into "/etc/polkit-1/localauthority/50-local.d/99-www-reboot.pkla"
# To apply the changes restart the policykit with "systemctl restart polkit.service"
#
# Note: The "localauthority" direcotry can only be viewed by root.
[Allow www-data rebooting]
Identity=unix-group:www-data
Action=org.freedesktop.login1.reboot*;org.freedesktop.login1.set-wall-message
ResultAny=yes
ResultInactive=yes
ResultActive=yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment