crontab editor (alternatives redux)
Well, my Debian server seems to think I should edit crontabs by with pico. So, the fix (as with Ubuntu) :
update-alternatives --set editor /usr/bin/vim.tiny
un-ubuntuing visudo: how to make visudo use vi instead of nano
At some point, Ubuntu decided that it was best to have “visudo” — which refers to the vi editor by name — use the nano editor by default. If, like me, you are trying to edit the sudoers file, and you don’t want to use nano, or if you want to change visudo “back” to using vi (as intended), then read on. Note that this also will change your default editor to vi, or change the default to whatever editor you choose.
visudo takes its cue from the alternatives configuration system, which means it looks to /usr/bin/editor, which itself points to /etc/alternatives/editor.
The Ubuntu way to change the default editor (which will be used by visudo) then is to run
update-alternatives --config editor
That should go something like this:
laptop:~$ sudo update-alternatives --config editor
[sudo] password for obelix:
There are 6 alternatives which provide `editor'.
Selection Alternative
----------------------------------------------- 1 /usr/bin/vim.tiny
2 /bin/ed
3 /bin/nano
4 /usr/bin/vim.basic
*+ 5 /usr/bin/vim.gnome 6 /usr/bin/mcedit-debian
Press enter to keep the default[*], or type selection number: 1
Using '/usr/bin/vim.tiny' to provide 'editor'.
laptop:~$
Finally, here's what the filesystem structure looks like:
laptop:~$ ls -l /usr/bin/editor
lrwxrwxrwx 1 root root 24 2008-12-17 14:57 /usr/bin/editor -> /etc/alternatives/editor
laptop:~$ ls -l /etc/alternatives/editor
lrwxrwxrwx 1 root root 18 2009-04-23 17:32 /etc/alternatives/editor -> /usr/bin/vim.tiny
[sudo] password for :
There are 6 alternatives which provide `editor'.
Selection Alternative
-----------------------------------------------
1 /usr/bin/vim.tiny
2 /bin/ed
3 /bin/nano
4 /usr/bin/vim.basic
*+ 5 /usr/bin/vim.gnome
6 /usr/bin/mcedit-debian
Press enter to keep the default[*], or type selection number: 1
Using '/usr/bin/vim.tiny' to provide 'editor'.
laptop:~$