Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Sep 2001 03:03:10 -0500
From:      Mike Meyer <mwm@mired.org>
To:        "Bob Hall" <rjhalljr@starpower.net>
Cc:        questions@freebsd.org
Subject:   Re: Setting TERM for ssh
Message-ID:  <15251.14654.625217.863635@guru.mired.org>
In-Reply-To: <123713767@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Bob Hall <rjhalljr@starpower.net> types:
> On Sun, Sep 02, 2001 at 05:25:01AM -0500, Mike Meyer wrote:
> > Bob Hall <rjhalljr@starpower.net> types:
> > > Does anyone know how to set TERM for ssh? The ssh man pages say that you 
> > > can do this, but they don't say how. I've been researching and 
> > > experimenting for several days now, but haven't found the answer.
> > The man pages on 4.4-RC don't say you can set the terminal
> > environment. However, it does say that sshd reads
> > $HOME/.ssh/environment for lines of the form "name=value" to add to
> > the environment. Would that do what you're looking for?
> My conception of what happens at the start of an ssh session is that 
> my ssh software reads the TERM setting in $HOME/.ssh/environment and 
> passes that to my remote account.

I think you've got it backwards, but the information is in the sshd
man page, not the ssh man page. That's because sshd reads
$HOME/.ssh/environment on the remote system, and adds those things to
the environment before it starts your shell. So you need to create
$HOME/.ssh/environment on the remote system - or check the
documentation on the ssh daemon it's running if it's not a FreeBSD
system.

> The remote account receives the TERM value for the current shell, 
> regardless of the setting in the environment file.

This really is the most desirable behavior. The correct terminal type
depends more on the remote system than the local system - so you need
to set it on the remote system, not the local one. However, most Unix
systems have similar - if not identical - terminal descriptions, so
passing the current value across the wire is a reasonable first guess.

> If I set the bash 
> TERM to vt220, I can use the remote account without problem, but 
> applications that use color are monochrome. If I set TERM in the 
> environment file, the remote account complains about the 'cons25' 
> setting. I'm trying to find a way to set TERM for the ssh session, 
> and only for the ssh session. Is this possible, or does the ssh 
> session have to have it's own terminal with it's own shell in order 
> to have it's own TERM value? And if so, what is the point of the 
> environment file? I'm sure it does something, but what?

You could just alias ssh to "TERM=vt200 /usr/bin/ssh", assuming you're
using an sh-like shell.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15251.14654.625217.863635>