Sudo password-less commands

nry

Limp Gawd
Joined
Jul 10, 2008
Messages
409
I am trying to create a PHP script which will SSH into my NAS and power it down. Probably better ways of doing it, but thought this would be the easiest.

PHP side I am fine with, the issue is creating a sudo command which can be run without a password.

I have created a user 'power' with the group of 'power' on my NAS.

Then using
Code:
sudo visudo

I have added the following below the root sudo... (stolen from here https://wiki.archlinux.org/index.php/Allow_Users_to_Shutdown)
Code:
root    ALL=(ALL:ALL) ALL
power   ALL=NOPASSWD:/usr/bin/shutdown -h now,/usr/bin/halt,/usr/bin/poweroff

Have tried logging back in via SSH as 'power' user but I still get asked for a password when doing any of the above commands as sudo.

Assuming I have done something wrong here, can anyone point me in the right direction to getting this working? :D
 
Try adding spaces after the commas.

Beyond that it looks fine.
 
Last edited:
Back
Top