Failed to reload nginx.service: Interactive authentication required
Most probably nginx
doesn't run with user root
which is what you need to use systemctl
. Therefore you should execute your command using sudo
.
Now there are different ways of running a command from web-server with root
privileges:
- Run
nginx
with userroot
which is highly discouraged for obvious security reasons - Add only this specific command to
sudoers
as described here in order to run it withroot
privileges without any password prompt - Pass your
root
password throughecho
as described here - Write a bash script with limited functions as described here
But of course you might find something else searching on for it.