0

I have the following entries in the sudoers file:

christian ALL=(root)NOPASSWD: /usr/sbin/shutdown
christian ALL=(root)NOPASSWD: /usr/bin/systemctl start mc

When running sudo shutdown -h now or sudo systemctl start mc, I still have to enter the password, even though I've set the NOPASSWD option for these commands. I am not sure why, because as far as I've read, this should be the correct syntax for it.

As far as I know I have to use an absolute path in the sudoers file, but I call it without. That might be the issue, but how do I make sudo workable with that then?

I'm using Ubuntu 20.04.6 LTS. What am I missing?

2
  • 1
    does there need to be a space before NOPASSWD and possibly, no space after?
    – user253751
    May 16 at 18:40
  • This is it. I was not expecting this... Thank you.
    – Apollo
    May 17 at 5:34

1 Answer 1

1

NOPASSWD: comes before the command, not after the users. Try adding a space before NOPASSWD: and maybe removing the space after.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .