Bugzilla – Bug 627
Sudo'd shell: command line editing doesn't work
Last modified: 2013-12-04 08:54:54 MST
After creating a root shell via sudo sh, vi-style command line editing (set -o vi) no longer works: the ESC character used to switch to command mode is interpreted literally, i.e., echoed to the screen. TTY settings as reported by stty are unchanged. This is probably not a Sudo bug per se, but probably the result of some interaction I don't understand; neither the manual nor brief googling provide an explanation. It might be worthwhile adding the appropriate information to the manual or a FAQ.
On many systems, root's shell does not support command line editing. For example, Debian-based Linux systems (including Ubuntu) use dash as /bin/sh. That shell does not have command line editing compiled in. If you want command line editing, try running "sudo bash" instead.
You can also use "sudo -s" as a shortcut to run your shell as root, rather than the shell configured for the root account.