Ubuntu – Escape key, arrow keys, etc not working in remote shell to server, but work on server’s local shell

bashkeyboardremote

Note, I am running these systems on VMWare Player.

Referencing this Arrow keys, tab-complete not working, it seems I should check to be sure my remote shell is running bash. My session is bash according to

echo $0
bash

Yet my arrow keys and escape key still print the following respectively

^[[D^[[A^[[B^[[C^[

Why are the key mappings so wonky?

Note: Bash and SSH version on server are a bit old (see comments). Client is up to date.

UPDATE:
I logged into the actual machine and the escape keys etc are working. It's just that when I connect with the remote shell they fail to work.

Best Answer

From your previous question we know that you're dealing with an older Ubuntu system and bash 3.2 version.

Some of the shells don't come with readline library support (see my related question about this), which is what causes the control characters to show up on screen. Good example of that is Korn shell and Dash. I couldn't find whether or not bash 3.2 comes with readline library support. I'll ask around to make sure.

However, based on the output of locate readline.so you provided in the comments, it seems like your bash indeed is missing that library. Here's output of the same command from my system with bash 4.3.

$ locate readline.so                                                           
/lib/x86_64-linux-gnu/libreadline.so.5
/lib/x86_64-linux-gnu/libreadline.so.5.2
/lib/x86_64-linux-gnu/libreadline.so.6
/lib/x86_64-linux-gnu/libreadline.so.6.3

You could attempt to run set enable-keypad on but I doubt this will have any effect without readline library present.

The obvious solution would be to upgrade bash, but since you need this system for infosec studies, i assume you might want to keep it as is.


I've asked a related question on unix.stackexchange.com. You can check if bash uses readline with nm command , as shown in Thomas's answer

Related Question