0

Is it possible to debug when sudoers is seemingly not working?

I'm trying to give a user called power access rights to shut down a Synology NAS from ssh without sudo.

Here is my one and only record for the power user at the very end of the /etc/sudoers file:

power ALL=(ALL) NOPASSWD:/sbin/shutdown*

When I log in as power and issue the following command, it does not work:

power@synology:/$ shutdown -h now
shutdown: Need to be root

1 Answer 1

3

This is a common misconception of the NOPASSWD clause in sudo. You still need to add sudo before your command or else it won't be processed correctly. A better solution would be to give your user an alias to shutdown - alias shutdown='sudo shutdown' - so on the surface it will look the same.

1
  • Thank you, absolutely right! It works now! Commented Dec 13, 2020 at 7:16

You must log in to answer this question.

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