I have webpage with button, when user clicks on button, script restart.sh
on server is executed. This script contains:
#!/bin/bash
systemctl restart rspamd.service
After clicking on the button, restart.sh
is executed, but rspamd.service is not restarted: "Failed to restart rspamd.service: Access denied" Because the script is executed by click on button on webpage, the real user who runs it on server is www-data
. I tried to set suid bit to run script as root, but it's not working. How can I restart rspamd.service as www-data
user?