You are not logged in.
Pages: 1
Topic closed
I don't have vi installed (but do have vim) and since visudo uses vi as the default editor, I've set both VISUAL and EDITOR in .bashrc (as per the manual).
$ echo $EDITOR $VISUAL
vim vim
However, visudo still complains that vi isn't installed:
$ sudo visudo
visudo: no editor found (editor path = /usr/bin/vi)
Naturally, I'm running visudo with sudo... would that cause the issue or is this a bug?
Offline
Yeah, I tried that:
$ sudo cat /root/.bashrc
EDITOR="vim"
VISUAL="vim"
Offline
ln -s /usr/bin/vim /usr/bin/vi
will fix the problem, but it isn't really a clean solution (maybe make a pkgbuild for vi that's just a symlink?)
Offline
Did you try
man visudo
it says that it does not respect EDITOR or VISUAL. There are ways around it however.
Offline
isnt it:
export EDITOR="vim"
Offline
sudo EDITOR=vim visudo
Also, exporting the EDITOR variable in root's account would probably set the editor correctly for when you sudo visudo, but I'm just guessing atm.
Last edited by Square (2010-05-26 20:29:00)
Offline
@scio: really?
ENVIRONMENT
The following environment variables may be consulted depending on the value of
the editor and env_editor sudoers variables:VISUAL Invoked by visudo as the editor to use
EDITOR Used by visudo if VISUAL is not set
@brisbin33: Yeah, that works. Maybe it should be set as default in Arch? Though I recall reading there maybe some security risks involved...
@Square: bingo! that's my preferred method (though, no, it doesn't work if you set it in roots .bashrc (if that's what you mean))?
@brisbin,
where did you add this? In your bashrc?
Regards
That goes in /etc/sudoers
Offline
I just noticed this old bug report. Since vi is no longer symlinked to vim by default (correct me if I'm wrong and that never was the case), perhaps visudo should be built with "--with-editor=/usr/bin/vim"?
Offline
@brisbin33: Yeah, that works. Maybe it should be set as default in Arch? Though I recall reading there maybe some security risks involved...
There is no easy way to prevent a user from gaining a root shell if the editor used by visudo allows shell escapes.
maybe this is the risk in using vim?
//github/
Offline
Offline
Defaults env_editor is the key.
Set your Sudo-user's $EDITOR environment variable to the binary of your favorite text-editor.
Last edited by Wintervenom (2010-05-27 11:50:53)
Offline
# Defaults specification
Defaults editor=/usr/bin/vimI tried that out but he still complains to need vi. Could this be a problem due to the bug report gladstone posted above?
Regards
By adding /usr/bin/vim to Defaults it works perfectly however you have a security risk as vim can execute command in root. So you should add noexec for vim. Have a look at the manpage of sudoers for help. Look for preventing shell escape.
Offline
@scio: really?
man visudo wrote:ENVIRONMENT
The following environment variables may be consulted depending on the value of
the editor and env_editor sudoers variables:VISUAL Invoked by visudo as the editor to use
EDITOR Used by visudo if VISUAL is not set
Yes, really. Just like brisbin33 said, you need to add either editor or env_editor to your sudoers file.
I just noticed this old bug report. Since vi is no longer symlinked to vim by default (correct me if I'm wrong and that never was the case), perhaps visudo should be built with "--with-editor=/usr/bin/vim"?
I would disagree since vim is in [extra] and vi is in [core].
Offline
What fixed it for me was removing the conflicting global EDITOR definition I had in /etc/environment.
Offline
So you necrobumped a 13 year old thread to let everyone know that you misconfigured your system…
Offline
Closing this old thread.
Offline
Pages: 1
Topic closed