shutdown -h now
<your username> ALL=(ALL) NOPASSWD: /sbin/shutdown
Fred Wilma = NOPASSWD: /sbin/shutdown
mf205 wrote:I'm also interested in being able to use the shutdown command without entering my password. I tried editing sudoers as above, but I must have done something wrong: now whenever I issue sudo (including sudo visudo!) I get
sudo: parse error in /etc/sudoers near line 32
sudo: no valid sudoers sources found, quitting...
sudo: unable to initialise policy plug-in
How do I fix this?
visudo parses the sudoers file after the edit and will not save the
changes if there is a syntax error. Upon finding an error, visudo will
print a message stating the line number(s) where the error occurred and
the user will receive the "What now?" prompt. At this point the user
may enter "e" to re-edit the sudoers file, "x" to exit without saving
the changes, or "Q" to quit and save changes. The "Q" option should be
used with extreme care because if visudo believes there to be a parse
error, so will sudo and no one will be able to sudo again until the
error is fixed. If "e" is typed to edit the sudoers file after a
parse error has been detected, the cursor will be placed on the line
where the error occurred (if the editor supports this feature).
visudo -f /etc/sudoers
# 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.
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
Users browsing this forum: Bing [Bot], MtnDewManiac and 25 guests