When I ssh to my my remote server, a solaris machine running SunOS 5.9 with C-shell as default login shell I have the following issues:

  • TERM variable is not defined: I need to manually set this variable to xterm to be able to edit files, else I have an unfriendly message:

I don't know what kind of terminal you are on - all I have is 'xterm-256color'.

  • keyboard is not well recognized:
    • backspace clean the complete command line buffer. I found a solution here
    • tab does a tab, not autocomplete
    • del key puts junk in the console buffer (^[[)
    • arrow keys put junk in the console buffer (^[) and insert A, B, C, D instead of moving the cursor within vi.
    • probably more

I've found some way to fix the backspace by using the stty command (here: Backspace, Tab not working in terminal (using ssh)), but I need a complete remap of the keyboard...

How can I setup my ssh session to fix both the term issue and the keyboard issue at login time ?

PS: The remote 'user' is a 'shared' account used by all developers and where is located our backend distribution. I don't want to touch the .*rc script to avoid any undesired side effects

3 Answers 3


Since it is a shared account (won't discuss how unadvised this 'normally is) - and you are using csh you will need to do two things

  1. create a personal environment file comparable to the .login file (.login is to csh as .profile is to bash, sh, etc.
  2. after login enter source 'file_just_created'

In the file you create you can do something simple for backspace - whatever you are already doing, e.g.,

stty erase ^H

also, for your TERM setting - just add in the file!

setenv TERM xterm

or whatever value you need/works for your terminal sessions

Summary - create mySetupFile with one or more stty commands, plus setenv TERM myFavTermName and after login at prompt source mySetupFile

EXTRA: You could also look for the terminfo file for xterm, e.g. /usr/share/lib/terminfo/x/xterm and if /usr/share/lib/terminfo/x/xterm-256color does not exist, if permitted see if

ln /usr/share/lib/terminfo/x/xterm /usr/share/lib/terminfo/x/xterm-256color

fixes your editing problems.

If that works there are other things that could also be done (to make and define a new terminfo use the command tic aka terminfo compiler iirc. Might make a lot of people happy.

  • Is there any way to order ssh client to source the login script by itself ?
    – Guillaume
    Commented Nov 25, 2016 at 8:26

In your home directory for your user you should have a few hidden login script files. Open an SSH session as your user, make sure you land in home by running pwd command. If not the cd $HOME to get there.

In there list out the contents with ls -la to show hidden files. You should have a .login, .cssh, .bashrc, .ksh, or similar named file that is executed when you login. You can set custom commands here, or export environment variable.

The other option to set environment variables to be passed with ssh connections is to edit your /etc/ssh/sshd_config file on the server to accept new environment variables by putting AcceptEnv MYVAR. You would also have to setup your client SSH program to send those variable for the ssh server side to receive then set them by setting SendEnv MYVAR.

  • I forgot to mention that the user is a 'shared' account used by all developers and where is located our backend distribution. I don't want to touch the .*rc script to avoid any undesired side effects...
    – Guillaume
    Commented Nov 24, 2016 at 17:31
  • What is your ssh client program such as PuTTY, or another Linux server? Commented Nov 24, 2016 at 17:39
  • Didn't meant to submit that last one incomplete. In clients such as PuTTY you can select the term type for your choice in the session settings. If you are coming from a command line type environment you can set the term variable on the local ssh client end before connecting via ssh which should cause it to pass through, assuming the ssh server is accepting the TERM variable (most do I believe). TERM=xterm-256color ssh remotehost Commented Nov 24, 2016 at 17:42
  • I run ssh from a linux box. And the trick with the TERM prepended to the the ssh command works fine. Many thanks!
    – Guillaume
    Commented Nov 25, 2016 at 8:29

csh on Solaris is Bill Joy's original csh, which uses Escape, not Tab, for autocomplete (and that's only active if you set filec first), and has no command line editing, with or without arrow keys. If you want those features, you need to use tcsh instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .