I'm trying to add a new sudoers file using sudo visudo -f /etc/sudoers.d/abe . I added the contents:

# Allow automatic update of abe
matt    ALL=(root) NOPASSWD: python /home/matt/token-abe/setup.py install --force

But when I try to write and quit, I get "What Now?" with no error:

$ sudo visudo -f /etc/sudoers.d/abe
[sudo] password for matt: 
What now? e
What now? 

I'm using Debian 7.

up vote 7 down vote accepted

There is an error in the file you just edited, this is why visudo is complaining. From http://www.courtesan.com/sudo/man/1.7.10/visudo.man.html:

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).

About your error, isn't the "python" command missing the complete path? I mean:

matt    ALL=(root) NOPASSWD: /usr/bin/python /home/matt/token-abe/setup.py install --force
  • 1
    Indeed, thankyou, it needed the full path. Though shouldn't visudo give an error message explaining the error? – Matthew Mitchell Sep 18 '14 at 17:13
  • debian gave me error ">>> /etc/sudoers: syntax error near line 32 <<<" in this exact situation – Antony Hatchkins Sep 28 '15 at 5:33

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.