Whenever I ssh to my desktop, I change $TERM to ansi so that ssh works better with the Windows terminal. I decided to create ~/.ssh/rc and add TERM=ansi to it. The problem is, after I ssh into my desktop, the terminal type is still msys instead of ansi. Is there a way to fix this?


I couldn't get the TERM setting to work from ~/.ssh/rc either.

I could get it to work by changing the following in /etc/ssh/sshd_config

PermitUserEnvironment yes

followed by a restart of sshd and taking into account the warning from man sshd_config,


Specifies whether ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd(8). The default is “no”. Enabling environment processing may enable users to bypass access restrictions in some configurations using mechanisms such as LD_PRELOAD.

Then I created the ~/.ssh/environment file and added the line,


logged back in and it worked.


This won't help much, but setting the TERM on the command line before calling ssh (on Linux) does set the term type on the remote end.

TERM=ansi ssh test@home.local
test@home.local ~ $ echo $TERM
  • Thanks! Unfortunately, the client is running Windows, so I can't change the terminal type client-side. Turning on PermitUserEnvironment worked, though! – Kookerus Nov 5 '15 at 0:38
  • @James, deleted my post - until it is resolved, it didn't contribute to the question...let me know if you figure anything out, i'm stumped too... – pete Nov 5 '15 at 1:31
  • @Pete, np, something strange is going on because you can, export TERM=ansi echo $TERM in the rc file and see that it prints 'ansi' but then ends up with the TERM still being set as 'msys'. – James Nov 5 '15 at 1:32
  • @James what is your OS? – pete Nov 5 '15 at 1:34
  • Linux - Gentoo and Ubuntu. – James Nov 5 '15 at 1:36

If you want to set up your variable, you should export it so it will get into your terminal that is exec-ed afterwards:

export TERM=ansi
  • I added that to .ssh/rc before posting the question, and it didn't work. – Kookerus Nov 5 '15 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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