Skip to main content
8 of 8
added 8 characters in body; edited title
Mike Pennington
  • 2.5k
  • 4
  • 32
  • 41

Force telnet / ssh to use crtl-H for backspace

I have some devices connected to a Cisco serial term server; many work fine when I telnet directly to the port on the Cisco. However, I have a few stubborn devices that will not use Backspace as it is mapped in telnet by default.

In case it matters, I telnet from rxvt under Debian squeeze (in an X Window). TERM is set to rxvt, but it doesn't matter whether I use vt100, vt101, or xterm... changing TERM has no effect. I started down the road of changing TERM based on what I saw in an old Kermit FAQ. FWIW, stty erase ^h and stty erase ^? don't work either.

I have noticed that Backspace works correctly on these devices if I use a raw TCP socket from netcat... i.e. nc 192.168.12.117 2006; however, then I run into other issues with passwords not hidden or terminal paging.

How can I selectively force telnet and ssh to map Backspace to CtrlH for these devices? Also, what criteria should I use to evaluate whether this is a bug in the device?

EDIT

In case it matters, this is the output from showkey -a for the keys in question... ^? corresponds to Backspace and ^H is CtrlH. It seems like I should be getting close when I look at The Linux Keyboard and Console Howto, but I can't seem to decipher what I can do to change this. I have tried various incantations with loadkeys to no effect.

[mpenning@hotcoffee docs]$ sudo showkey -a

Press any keys - Ctrl-D will terminate this program

^?      127 0177 0x7f
^H        8 0010 0x08

I am also including relevant output from dumpkeys as well... this is the current mapping in my system (which doesn't work on some devices in question). If I could figure out how to get Backspace to do the same thing as CtrlH, I would have a solution.

[mpenning@hotcoffee docs]$ sudo dumpkeys | grep -Ei "backspace|127"
keycode   8 = BackSpace        ampersand        braceleft       
keycode  14 = BackSpace        Delete          
        control keycode  14 = BackSpace       
keycode 127 =
[mpenning@hotcoffee docs]$
Mike Pennington
  • 2.5k
  • 4
  • 32
  • 41