Set a other locale for SSH

Hello together,

is it possible to set a other locale for login over ssh? I Have the problem, that when I logged in on the IPFire over local Monitor and keyboard, i have the right locale and my mc looks so as it should be. When I login over ssh, my mc looks strange. Shows mystic characters. I have to set latin in putty that I get the right output.

I found with env that when I use ssh, the variable is set to TERM=xterm
When i login local env says TERM=linux

Can I change this settings in a IPFire 2.27 174?

The TERM variable is set in the PuTTY configuration under Connection > Data > Terminal-Type string.


Thank you for the answer, I know it that i can set it there. But is there a possibility to set the env for ssh also to TERM=linux like when you are logged in to the server local?

The TERM variable is used by the receiver of terminal output to interpret the characters. So if you want to set it like on the console you have to set it in PuTTY ( the receiver of the SSH character stream ).


I might be wrong, but I believe that if the .profile, which is the login and interactive shell configuration file present in IPFire, is set to export the TERM environment variable, it will be the last to be executed, therefore it will determine the value of TERM. In other words, if putty say TERM=linux and .profie (or .bash_profile) says TERM=xterm, the latter will be the one used.

This is my understanding of this issue. In a ssh session, the setting of the client’s terminal (e.g. putty) is communicated to sshd daemon running on IPFire, which then sets accordingly the TERM environment variable. However, if TERM is also set in /etc/profile or in .profile, or .bash_profile in HOME (or in .bashrc if sourced by .profile), then this setting will happen after SSHD and therefore it will be the one used by your terminal.

If you want to have putty deciding the TERM variable, you have two options, either you do not set it in any of those files, or you put a conditional in the one file among those you are using, something like:

if [[ -z "${SSH_CLIENT}" && -z "${SSH_CONNECTION}" ]]; then
    export TERM="linux"

which will test if both SSH_CLIENT and SSH_CONNECTION are set (when you SSH they are) and return a different value for TERM than the default.

Default IPFire has no .profile and the present .bash_profile or the executed (.)bashrc does not change the TERM variable. (It only use it to configure the output of the prompt.)