This question already has an answer here:
My goal is to use reboot as myusername without entering a password. How can I achieve this?
I have read Allowing a user to use sudo without a password and followed the suggestions but it still doesn't work for me. Here is my
/etc/sudoers but it still asks for a password:
# # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL myusername ALL=NOPASSWD:/sbin/reboot # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d
I then run
and am asked for a password. How can I run
reboot as a normal user without being asked for a password?
sudo -l output :
Matching Defaults entries for myusername on this host: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin User myusername may run the following commands on this host: (root) NOPASSWD: /sbin/reboot (ALL : ALL) ALL
I also tried with
sudo ls still asked for a password so this seems to be a general problem, not specific to