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?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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
nano (find their path with
which). Or just running this worked for me (though I can't recommend
sudo EDITOR=vi visudo
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:
Or in your specific file's case:
sudo visudo -f /etc/sudoers.d/relax_requirements