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.

I use WinSSHd on several Windows servers. To access them from my Mac (and presumably, just about any Unix-based terminal), I need to set the TERM environment variable to cygwin, e.g.:

TERM=cygwin ssh someserver.com

I can also use the .ssh/config to set certain defaults for that server, such as a different user and non-default port:

host someserver.com
    User SomeDifferentDude
    Port 22222

However, I apparently can't set environment variables that way. I haven't found anything in man ssh_config, anyway. Is there a way to set the default terminal emulation (and/or any environment variable) per host?

share|improve this question

3 Answers 3

You would typically set the environment variable on the server side.

If WinSSHd is sufficiently like openssh (the usual unix implementation of ssh), you can define an environment file (~/.ssh/environment on unix) and put TERM=cygwin there.

You can also set the environment variable in your shell initialization file. Since you mention cygwin, this is presumably ~/.bash_profile where ~ is your cygwin home directory. You should set it conditionally, in case you also use cygwin on other terminal types; for example, to set it only if you are logging in over ssh (again, assuming WinSSHd is sufficiently like openssh):

if [ -n "$SSH_CLIENT" ]; then
  export TERM=cygwin
fi
share|improve this answer
    
Thanks. I couldn't find a way to set environment variables in its server settings, but ended up finding a much better solution. –  Sören Kuklau Aug 15 '10 at 9:43
up vote 1 down vote accepted

It turns out there's a much better solution — WinSSHd supports Unix's terminfo format, so all I had to do is copy the proper terminfo file (in the case of OS X: xterm-color) into its directory, and the TERM=cygwin setting become unnecessary.

share|improve this answer

You can use SendEnv TERM to set the TERM on the server to be the same as the TERM on your local machine.

share|improve this answer

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.