Bug 627

Summary: Sudo'd shell: command line editing doesn't work
Product: Sudo Reporter: Konrad Schwarz <konrad.schwarz>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED INVALID    
Severity: low    
Priority: low    
Version: 1.8.3   
Hardware: PC   
OS: Linux   

Description Konrad Schwarz 2013-12-03 01:25:28 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.
Comment 1 Todd C. Miller 2013-12-03 08:09:00 MST
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.
Comment 2 Todd C. Miller 2013-12-04 08:54:54 MST
You can also use "sudo -s" as a shortcut to run your shell as root, rather than the shell configured for the root account.