I know this has been asked before, but I tried answers from dozens of other posts, and nothing is working. I've also used this on other servers successfully, so I'm not sure what I'm doing wrong this time. Unfortunately, those servers are gone, so I can't use them as a reference.
I have a new Kubuntu 22.04 server, which I'm using to host my kid's Minecraft server. I'm trying to give an account permission to restart the systemd service without a password.
Steps:
- I created a new sudo file using:
sudo visudo /etc/sudoers.d/10-extras
- This is the only file (aside from README) in that folder.
- I've entered a single line:
family ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart minecraft-bedrock.service
systemctl restart minecraft-bedrock
still prompts for a password.
which systemctl
shows /usr/bin/systemctl
- I tried using
family ALL=(ALL) NOPASSWD: ALL
, with the same result.
- I tried using
family ALL=(ALL:ALL) NOPASSWD: ALL
, with the same result.
- I tried doing the above with my account, with the same result.
- Out of curiosity, I tried the above on my VPS running Ubuntu 22.04 (using a different service), with the same result.
- I tried all the syntax variations I've seen on other posts.
- I've confirmed that
@includedir /etc/sudoers.d
is the last line /etc/sudoers
.
- I've tried doing all the above in the
/etc/sudoers
file directly.
Can someone point me in the right direction? I must be missing something painfully obvious.
Thanks!