Can I change terminal type used to login through SSH?

If you have root access to the remote box, install the package ncurses-term. This will provide the rxvt-256color terminfo entry.

As a non-root user, you can also copy over the rxvt terminfo entries to $HOME/.terminfo/r/ on the remote machine, and export TERMINFO=$HOME/.terminfo.

ssh <host> 'mkdir -p .terminfo/r'
scp /usr/share/terminfo/r/rxvt-unicode-256color <host>:~/.terminfo/r/

after login you can execute something like:

export TERM=vt100

Usually TERM is passed from your local environment, unchanged, to the remote environment. If you set TERM on the local side when invoking ssh, that will do what is needed.

For instance, if the remote end has the terminal description for rxvt (but not rxvt-unicode), that would work well enough for function keys, etc.

Assuming bash or some shell which is POSIX-compliant, you can do this by

TERM=rxvt ssh remotehost

Doing it that way only affects the ssh command, not your local environment. I use this feature for handling typical machines which do not have the description for screen.xterm-new. Depending on the remote machine, there may or may not be a suitable package which can be installed for the full terminal database. Some (such as Solaris and FreeBSD) require the workaround.

Further reading:

  • The terminfo database is big—do I need all of that?