3

I tried to run the "sudo EDITOR=./sudo_editor visudo -f /etc/sudoers.d/relax_requirements" command and the error came out as: visudo: specified editor (./sudo_editor) doesn't exist

Anyone know what I should do in this situation?

2

You could just edit your sudo files with any editor, visudo just does it "in a safe fashion" to guard against some errors. But you can DIY with any editor, just keep a backup copy handy and a live iso ready to fix any errors just in case.

man visudo says:

 There is a hard-coded list of one or more editors that visudo will use
 set at compile-time that may be overridden via the editor sudoers Default
 variable.  This list defaults to /usr/local/bin/vi.  Normally, visudo
 does not honor the VISUAL or EDITOR environment variables unless they
 contain an editor in the aforementioned editors list.  However, if visudo
 is configured with the --with-env-editor option or the env_editor Default
 variable is set in sudoers, visudo will use any the editor defines by
 VISUAL or EDITOR.  Note that this can be a security hole since it allows
 the user to execute any program they wish simply by setting VISUAL or
 EDITOR.

So maybe your visudo can't override it's hard-coded list of editors. You could try refering to the editor with it's complete path, instead of ./ and that might work, or try a "default" editor like vi or nano (find their path with which). Or just running this worked for me (though I can't recommend vi ;-)

sudo EDITOR=vi visudo

Or

sudo EDITOR=nano visudo

Or even using a nice graphic editor like gedit if it's installed:

sudo EDITOR=gedit visudo

On a regular Ubuntu, (or Linux Mint & others too) just running this alone should work too:

sudo visudo

Or in your specific file's case:

sudo visudo -f /etc/sudoers.d/relax_requirements
| improve this answer | |
  • uummm i typed in your command and like i dont even know what to do cos theres like a list?? – Eve Jan 5 '15 at 20:05
  • So the command worked and you can use visudo now? That's good news, your original question is answered at least, now you can accept (check-mark) the answer if it worked. – Xen2050 Jan 5 '15 at 20:16
  • And you mean the sudoers file itself is confusing? I agree :-) You can look at man sudoers or man sudo for more info. Or you can ask a new question, asking exactly what you're trying to do, that might be easier – Xen2050 Jan 5 '15 at 20:16
  • i typed in the "sudo EDITOR=./sudo_editor visudo -f /etc/sudoers.d/relax_requirements" and it said that it was busy then i closed the other tabs and it now it says that it doesnt exist i am confused please help me... is it very necessary to keep adding new questions? – Eve Jan 5 '15 at 20:22
  • I thought the "specified editor doesn't exist" question was answered? Using "sudo EDITOR=nano visudo -f /etc/sudoers.d/relax_requirements" might be easier than using vi too, but vi and nano should be on Ubuntu... And visudo is supposed to "lock" the files so they can't be edited by 2 different programs at the same time. You can look for other running visudo programs with "pgrep -l visudo" and only run one at a time (can kill others with "sudo pkill visudo" but if it's been suspended then closing the terminal or fg should finish it off. – Xen2050 Jan 5 '15 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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