Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
I have the same problem - my host is Win7-64 and my remote guest systems are both Ubuntu Server 10.04. On one server, the keys work, on another, not. – Mateng Oct 26 '12 at 12:05
Additonal Info: I enter the remote machines with Putty / Kitty – Mateng Oct 26 '12 at 15:11
Can you try to ssh via a different program, or create a new profile for the target system? – belacqua Oct 26 '12 at 15:57
I faced the problem with cygwin (in win 7) too – gopi1410 Oct 27 '12 at 14:28
What is returned by typing echo "$TERM", when this occurs? – david6 Oct 28 '12 at 9:48
up vote 22 down vote accepted

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.

share|improve this answer
Seems legit. If gopi1410 agrees, the 50 reps are yours. – Mateng Oct 30 '12 at 15:11
@Mateng: agreed, & a link to your answer added to make it complete – gopi1410 Oct 31 '12 at 12:46
Run as root: sudo chsh -s /bin/bash – KrisWebDev Sep 5 '15 at 8:48
@Worked for me more than 3 years later. Thank you so much! You're awesome! – Aprendiz Feb 11 at 22:46

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

$ echo $0

which returned:


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:


[The problem arose due to a distribution update.]

share|improve this answer

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

share|improve this answer
I tried that, but the problem persists – Mateng Oct 26 '12 at 13:44
did you try term as VT100 instead of linux? what about stty erase <backspace> (<backspace> being where you actually hit the key) – Drake Clarris Oct 26 '12 at 15:57
With (Arrow Up):$ stty erase '^[[A' stty: invalid integer argument '\033[A'. With [Backspace]: $ stty erase '^?' it works. With [Tab]: $ stty erase ' ' no error, but then [Backspace] is back to odd behaviour. – Mateng Oct 26 '12 at 16:10
I tried export TERM=VT100, but no avail. – Mateng Oct 26 '12 at 16:15
stty tab0 does not help. I guess, some kind of general reconfiguration of xterm is necessary. Or the keymap is simply wrong? – Mateng Oct 29 '12 at 16:02

'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

share|improve this answer

As a root user edit /etc/passwd file for your user and change from /bin/sh to /bin/bash

hdfs:x:1020:1001::/home/hdfs:/bin/sh to hdfs:x:1020:1001::/home/hdfs:/bin/bash

This worked for me.

share|improve this answer

This is a compatibility issue with the keyboard, i.e., how it is interpreted in the host system. You might have to use j or h to move in the vi editor in the command mode. Arrows will not work.

Check the profile preferences->compatibility in the host system for that specific user.

share|improve this answer

I tried all the above plus notes from (this link) with no success. You may want to check vim is installed.

I usually use vi not vim. So I installed vim.

$ sudo apt-get install vim

After that, the keyboard strokes started working properly when I executed vi. Looking at the output of the following, it looks like vi was made an alias to vim after the install:

$ ls -al /etc/alternatives | grep vi 
lrwxrwxrwx   1 root root    18 Jan 13 09:38 vi -> /usr/bin/vim.basic
share|improve this answer

I know this is an old question, the working solution for me is:

sudo chsh -s /bin/bash <username>

May neet to log out and log in again.

This fixes the problems with backspace, tab and arrow keys.

share|improve this answer
And what does this command? – Pilot6 Feb 21 at 8:37
Why the downvote? I had the same problem, and took me several hours to find the answer. It turns out that among many reasons, one of them is when a user is created, a different shell could have been created, e.g. /bin/shell... the command chsh -s /bin/bash <user> changes the shell to bash so the problems associated with tab/del/arrow keys would disappear. – Green Feb 21 at 9:25
You could explain it in your answer. And this answer already exists with the same command. It is accepted. So what is new? – Pilot6 Feb 21 at 9:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.