amazon-linux-2023 icon indicating copy to clipboard operation
amazon-linux-2023 copied to clipboard

[Bug] - visudo starts wrong editor

Open g24swint opened this issue 1 year ago • 2 comments

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:

  1. Login into AL2023 instance
  2. 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 avatar Feb 22 '24 21:02 g24swint

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

danie-dejager avatar Feb 22 '24 22:02 danie-dejager

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.

elsaco avatar Feb 22 '24 23:02 elsaco