Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My ssh config file has accept env set as:

AcceptEnv LANG LC_*

I am a bit confused how when I ssh through some clients my TERM variable is set as xterm256-color, and other clients TERM is set as vt100. My .bashrc and /etc/profile do not have anything that is setting the TERM variable.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

$TERM is special – it is not sent as an environment variable (which wouldn't make sense for non-Unix systems anyway), but rather as a special "terminal type" field when establishing a pseudo-terminal channel, per RFC 4254 § 6.2.

6.2. Requesting a Pseudo-Terminal

A pseudo-terminal can be allocated for the session by sending the following message.

byte      SSH_MSG_CHANNEL_REQUEST
uint32    recipient channel
string    "pty-req"
boolean   want_reply
string    TERM environment variable value (e.g., vt100)
uint32    terminal width, characters (e.g., 80)
uint32    terminal height, rows (e.g., 24)
uint32    terminal width, pixels (e.g., 640)
uint32    terminal height, pixels (e.g., 480)
string    encoded terminal modes
share|improve this answer
    
Exactly what I was looking for, thanks! –  marcwho Jun 25 at 14:10

$TERM is set by the terminal, that is, the parent process of the shell you are running locally. It is used by applications to determine what the capabilities of the terminal is, for example whether it supports colour. It's very useful to forward this to any other hosts you connect to, since otherwise they would lose this knowledge of the capabilities about the end user terminal.

See for example Prevent SSH client passing TERM environment variable to server?

share|improve this answer
    
I'm not sure I understand your answer. My question is: how is TERM set if AcceptEnv does not allow it to be set. If this is detected automatically, what process does the detection, is there documentation anywhere on this? –  marcwho Jun 25 at 13:15
1  
As @grawity explained, it's special - it will be set no matter what AcceptEnv is set to. –  l0b0 Jun 25 at 13:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.