[Bug] - visudo starts wrong editor
Describe the bug vIsudo is bringing up the wrong editor and starting nano instead of vim. This is without having installed nano but just using the default as shipped with AL2023
To Reproduce Steps to reproduce the behavior:
- Login into AL2023 instance
- run sudo visudo
Expected behavior The editor that starts should be vim and not nano. update-alternatives does not provide any alternatives even though it should offer a vim, ed, and (lastly) nano offering
@g24swint
I install vim-enhanced package first:
dnf install vim
then add:
export VISUAL=vim
export EDITOR=vim
to your .bashrc and reload with
source .bashrc
From there on you'll see vim being used and not nano. This is for vipw and vigr too.
From visudo man page: The default editor path is /usr/bin/nano:/usr/bin/vim:/usr/bin/vi
Because nano is part of the AL2023 base image and vim is not nano will be used by visudo. Set your preferred editor just like @daniejstriata mentioned above.