[PLUG] visudo for ubuntu ... pico? nano? joe?

Ben Koenig techkoenig at protonmail.com
Mon Oct 4 13:48:24 UTC 2021


$ echo "export EDITOR=ed" >> ~/.bashrc
$ echo -e "alias edsudo=\"visudo\"" >> ~/.bashrc

restart your shell, and experience everything a line editor has to offer.
$ edsudo

Could also set the alias to nanosudo or joesudo.

Or just edit directly with nano if you are confident that you never make mistakes.
-Ben

Sent from ProtonMail mobile

-------- Original Message --------
On Oct 4, 2021, 1:12 AM, Keith Lofstrom wrote:

> I am learning about Ubuntu sysadmin, and why I should use
> visudo instead of logging in as root user to use vi.
> This assumes that Eve hasn't inserted a malware version
> of visudo into my path ...
>
> Except - on Ubuntu 18.04 LTS, visudo calls the "nano"
> text editor, and on 20.04 LTS it calls the "joe" text
> editor. So WHY still call it visudo?
>
> Anyway, I will use vi (aka vim) until they pry my keyboard
> out of my cold dead fingers. I change editors as often as
> I change lungs.
>
> Other helpful guest sysadmins may prefer this shifting
> editor nonsense, so I plan to leave /usr/bin/visudo as-is
> and create a /usr/local/sbin/vvisudo shell script
> containing "sudo EDITOR=vim visudo" ...
>
> ... and add Yet Another Postit with how to exit nano
> or joe, or whatever editor they eventually choose for
> 22.04 LTS, in case I forget the extra v for vvisudo.
>
> Keith
>
> P.S. Ctl-x for nano, Ctl-k for joe. I think ...
>
> P.P.S. vi turns fifty in 2026. I've used it since it
> was beta. Others change editors more often than they
> change their underwear.
>
> --
> Keith Lofstrom keithl at keithl.com


More information about the PLUG mailing list