sudoedit is an abstract reference, that is it will point by default to the editor selected by the distribution, or if the default is overridden to whatever editor selected see http://www.cs-repository.info/. This override likely would be caught by a system admin, but not by an inexperienced user (who could have actually made the changes). The danger here is the non-default editor could have shell escapes. An additional caution is that an example presented pedagogically would be different if the default editor had be changed to vi or emacs both of which have been defaults for sudoedit in the past, or other editor. vi is currently the default choice of http://www.sudo.ws/sudo/sudo.html
nano is a specific GNU editor with no shell escapes (and is the default sudoedit editor in later distributions of Ubuntu). When executed with the "
-B" ( or "
--backup") option it offers safety and relative ease for superuser editing using the terminal.
gksu gedit is excellent for this purpose and favored by the command-line phobic or command-line adverse. I after 45 years in this business used it until I discovered nano.
My idea⋯offer gksu gedit $file or nano -B $file with the other as an alternative and leave sudoedit alone.
Personally, I would never recommend sudoedit to a non-sysadmin.
That's my 12₵ worth (2₵ in '65 dollars)
O.K., another 12₵ worth…
First of all, when I was first introduced to sudo I didn't like it. After all, when I first started using computers, the terminal was a real teletype machine.
But I've learned to go with the flow, and there were some very good reasons to use sudo, a good synopsis is here. Basically for the inexperienced user it helps prevent unintended consequences when superusing (or super like using).
But the protection of sudo can be breached by shell escapes (i.e. http://docstore.mik.ua/orelly/unix/upt/ch30_26.htm), notably vi, which allows a user run commands in a subshell, as an superuser.
A senario is an inexperienced user finds out that he can change sudo while mucking about on the Internet(i.e. diddling with
/etc/sudoers) to, for example, use sudo without requiring a password . He does this and then discovers all the other cool things he can do. The unintended consequence here is that the inexperienced user may not grasp all the implications of
sudo visudo. Abstraction e.g. sudoedit and
sudo visudo contribute to unintended consequences.
- Of course trying to protect users from these things is like herding cats.
nano is a great choice for inexperienced users (and for me who likes to eschew the command-line when practical) in that it is most like GUI editors. I'm confident that's why Ubuntu selected it as the default editor of sudoedit.
But my thinking is to avoid abstraction unless it has obvious benefits, hence sudo nano -B vice sudoedit and occasionally
gksu gedit $file (or
gksu jEdit $file if I'm amped up).
- The nub of the discussion is how far to go herding cats.