1

I have Ubuntu 18.04.1 LTS and trying to execute "poweroff" as a sudoer but without needing to enter the password.

I added this line to visudo:

nurp    ALL = NOPASSWD: /sbin/poweroff

It gives this error:

nurp@nurp-OptiPlex-7040:~$ poweroff
Failed to set wall message, ignoring: Interactive authentication required.
Failed to power off system via logind: Interactive authentication required.
Failed to open /dev/initctl: Permission denied
Failed to talk to init daemon.

I tried sudo poweroff -f but then it asks for password. I just want to run a long script and poweroff after it finishes. I don't want to type password on the command line.

nurp
  • 131

0 Answers0