I've given my user root permission to run systemcl via visudo.
# visudo
XXXXXX ALL=NOPASSWD: /bin/systemctl restart shiny-server.service
After logging out and back in, I run the command:
$ /bin/systemctl restart shiny-server.service
And get:
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'shiny-server.service'.
Authenticating as: XXXXXXX
Password:
I'm seeing things on line talking about polkit
but I'm not sure if that also needs to be configured along with visudo
. What's required here to prevent a password from being required to run the command as a specified user?
You set up
sudo
to allow you to run a command without a password, but you didn't actually run the command withsudo
!To fix the problem, run the command with
sudo
.