I'm trying to make an ssh connection (via lsh) from one Ubuntu host to another from within screen. If I try to run mc right after that I get the following error:

Unknown terminal: screen-256color-s
Check the TERM environment variable.
Also make sure that the terminal is defined in the terminfo database.
Alternatively, set the TERMCAP environment variable to the desired
termcap entry.

The question is - who's causing this failure? Is it local host? remote? some package missing (which?), something not done by lsh-server? or client?

Just to be clear - I don't want workarounds like "TERM=xterm mc", I want to be able to use visual themes which support 256 colors on the (remote) console.


3 Answers 3


Just set another TERM, For example






Maybe an export TERM helps too.

The TERM variable is used by curses and termcap programs, such as mc or dialog, to read the terminal escape codes from the terminfo/termcap databases, where the command is executed, so in your case in the remote system.

To support the "screen-256color-s" TERM type this terminal type must be installed in the database.

As a good starting point read man 5 terminfo.

  • Faking TERM will give you many problems, like certain keys not working. It is a dirty hack that, today, should never be done. The correct answer is to install the terminfo for the terminal emulator in question (here, screen). Note that you don't need administrative access to do so, as you can use ~/.terminfo. Commented Nov 21, 2023 at 8:53

Finally, I've managed to figure out "obvious" package which supply screen-256-color-s (got to be installed on remote machine):

sudo apt install ncurses-term

fixed the problem for me: nice 256 colors and no need for ugly workarounds with environment variables. Hooray! :)

  • didn't work for me on an old ubuntu 12.04. ncurses-term installed fine but I still get 'screen.xterm-256color': unknown terminal type.
    – Calimo
    Commented Jul 22, 2018 at 9:09

GNU screen is setting $TERM locally, and ssh is passing that value to the remote side. There are a few things you can do.

  • Detect the screen-256-color-s on the remote side and set to a more sane. From that you can have case $TERM in screen-256*) TERM=screen;; esac.
  • From the local side, have screen set the terminal. In your ~/.screenrc file have: term screen.
  • If you have a screen command to open the ssh call, then add a -T option: screen -T screen ssh user@host
  • In you local ~/.bashrc, set the terminal if it detects the incompatible one similar to the remote side one above.

You must log in to answer this question.

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