5

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?

3 Answers 3

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
1
  • Thanks. I couldn't find a way to set environment variables in its server settings, but ended up finding a much better solution. Aug 15, 2010 at 9:43
1

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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .