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?
First of all you say a prayer to the computer gods that you have a backup of the file /etc/sudoers (it might be made automatically by visudo - not sure about that). If you do have a backup then replace the new file with the old one from a live cd. When you edit sudoers with visudo this is what is meant to happen:
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).
It should be foolproof - unless you pressed Q at any time. Your alternative would be to boot into recovery mode then a root shell and run
- Code: Select all
visudo -f /etc/sudoers
Which repairs the file.
If you can't work out how to do that you could copy my backup file which looks like this:
- Code: Select all
# 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:
You might be able to insert that into /etc from a live cd.
OK I was too late. Glad it was fixable anyway.
Fujitsu Lifebook AH532 Laptop. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Ubuntu12.10 (Unity), Mint14 (Cinnamon), Manjaro (Xfce).