Can I change terminal type used to login through SSH?
Solution 1
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/
Solution 2
after login you can execute something like:
export TERM=vt100
Solution 3
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:
Solution 4
You can also add following lines to your .ssh/config:
host *
SetEnv TERM=xterm
Or whatever terminal you prefer.
You can set that also per host
host foo.bar
SetEnv TERM=vt100
Solution 5
sshd process (from sshd(8) ) will read ...
6. Reads the file ~/.ssh/environment, if it exists, and users are
allowed to change their environment. See the PermitUserEnvironment
option in sshd_config(5).
and
8. If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists,
runs it; otherwise runs xauth. The “rc” files are given the X11
authentication protocol and cookie in standard input. See SSHRC, below.
you might whish to edit ~/.ssh/rc
to setup TERM's value, as this file is read before shell's profile.
Related videos on Youtube
syntagma
Updated on September 18, 2022Comments
-
syntagma over 1 year
When I login on some particular server through SSH (which I do not have admin access to), I get the following error:
urxvt-unicode: Unknown terminal type
(I also don't want to change my terminal type permanently). It is important because depending on the terminal type I get different colors when logged in.Is it possible to change the terminal type just when logging through SSH?
-
Ondra Žižka almost 6 yearsI don't have anything in
/usr/share/terminfo/
.