Backspace, Tab, Del and arrow keys not working in terminal (using ssh)

When I ssh into another Ubuntu machine with my account (with sudo permissions), my backspace key generates some awkward symbols on pressing. Also Tab, Del and Arrow keys don't work.

On the other hand, I also have another account on the same machine & when I ssh through this account, its terminal works perfectly fine. I couldn't figure out why is this happening.


Solution 1:

EDIT: Reference: Mateng's answer

Mateng is close in that I think you're probably running Bourne Shell. But you shouldn't be editing your /etc/passwd file directly. Try using the chsh command instead:

chsh -s /bin/bash

The -s flag will make the new shell (Bash in this case) your login shell, going forward.

Solution 2:

when you first ssh in, try these two commands

stty sane
export TERM=linux

I have to do this on some machines that I go into to fix exactly this problem

Solution 3:

The following changes solved the problem for me. First, I checked which shell was running:

$ echo $0

which returned:

/bin/sh

As I read in this post in Ubuntuforums, changing the shell to /bin/bash brings the solution. So I edited my user settings in /etc/passwd to:

johndoe:x:1001:104:John Doe:/home/johndoe:/bin/bash

I logged out, then logged in again. Strangely, I had to switch the shell manually (maybe some cache was active) by entering this:

/bin/bash

Voila!
[The problem arose due to a distribution update.]

Solution 4:

One of the easiest ways to fix this problem is to type /bin/bash at the command line interface prompt:

$ /bin/bash

The afore mentioned command will execute the Bourne Again Shell on top of the existing shell as a subprocess. This presents the disadvantage of utilising more resources, but nothing has to be edited and no special permissions are required. For example, in recent Kubuntu versions it will start a /bin/bash session atop the default /bin/dash command line shell interface.

To persist the changes, however, one possibility is to edit the /etc/passwd file and add/edit/replace the default shell to /bin/bash after the last ':' character in the line corresponding to the user. In order to edit this file, though, administrator privileges would be required.

Solution 5:

'Gbnome Terminal' does not exactly emulate 'xterm' ..

from: Wikipedia >> GNOME Terminal

GNOME Terminal emulates the xterm terminal emulator and provides some of the same features.


A treatise on the issue and solution(s) can be found here:

Linux Backspace/Delete mini-HOWTO

Every Linux user has been sooner or later trapped in a situation in which having working Backspace and Delete keys on the console and on X seemed impossible. This paper explains why this happens and suggests solutions. The notions given here are essentially distribution-independent: due to the widely different content of system configuration files in each distribution, I will try to give the reader enough knowledge to think up his/her own fixes, if necessary.

I assume that the Backspace key should go back one character and then erase the character under the cursor. On the other hand, the Delete key should delete the character under the cursor, without moving it. If you think that the function of the two keys should be exchanged, in spite of the fact that most keyboards feature an arrow pointing to the left (←) on the Backspace key, then this paper will not give you immediate solutions, but certainly you may find the explanations given here useful.

Simplest solution given (which may work here) is to use: bash$ export TERM=gnome