Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: OpenSSH: Dev

Modify $TERM from config

 

 

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded


cmadams at hiwaay

Jun 26, 2012, 11:40 AM

Post #1 of 5 (979 views)
Permalink
Modify $TERM from config

The terminal programs (xterm, gnome-terminal, etc.) in Fedora have all
supported 256 colors for quite a while, so there's a proposal for Fedora
to switch them to using "xterm-256color" for $TERM. One drawback would
be when you SSH to another host that doesn't have an up-to-date terminal
database and doesn't recognize "xterm-256color" (but does know "xterm").

I don't see a way to override $TERM for a particular host in
~/.ssh/config. Also, it would really be better to be able to modify it
(rather than just override it), with some way to say "drop the -256color
suffix if it exists".

Any suggestions? Would something along these lines be accepted by
OpenSSH?

I'd like to see this because I use "screen" a lot, and if it set $TERM
to "screen-256color", my SSH connections to my Juniper JUNOS routers
would be annoying (while they recognize "xterm-256color", they don't
know "screen-256color").

--
Chris Adams <cmadams [at] hiwaay>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


ras at anzio

Jun 26, 2012, 11:58 AM

Post #2 of 5 (938 views)
Permalink
Re: Modify $TERM from config [In reply to]

Perhaps the answer to this is to bring forward a concept from the telnet
protocol, into SSH. When a telnet client connects, it doesn't just say
"I am TERM=ABC". Instead there is an option negotiation process defined.
So if the server responds "I don't know what terminal ABC is", the client
can try "I am TERM=XYZ". This process can continue until the client
decides what is the best fit, and tells the host.

It's similar in concept to how, in SSH, authentication methods are
negotiated.

Another environment variable that would benefit from this approach would
be LANG. My client might want to try "LANG=en_US.UTF-8", but be able to
drop back to "LANG=en_US".

On Tue, 26 Jun 2012, Chris Adams wrote:

> The terminal programs (xterm, gnome-terminal, etc.) in Fedora have all
> supported 256 colors for quite a while, so there's a proposal for Fedora
> to switch them to using "xterm-256color" for $TERM. One drawback would
> be when you SSH to another host that doesn't have an up-to-date terminal
> database and doesn't recognize "xterm-256color" (but does know "xterm").
>
> I don't see a way to override $TERM for a particular host in
> ~/.ssh/config. Also, it would really be better to be able to modify it
> (rather than just override it), with some way to say "drop the -256color
> suffix if it exists".
>
> Any suggestions? Would something along these lines be accepted by
> OpenSSH?
>
> I'd like to see this because I use "screen" a lot, and if it set $TERM
> to "screen-256color", my SSH connections to my Juniper JUNOS routers
> would be annoying (while they recognize "xterm-256color", they don't
> know "screen-256color").
>
> --
> Chris Adams <cmadams [at] hiwaay>
> Systems and Network Administrator - HiWAAY Internet Services
> I don't speak for anybody but myself - that's enough trouble.
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev [at] mindrot
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
>
>

Regards,
....Bob Rasmussen, President, Rasmussen Software, Inc.

personal e-mail: ras [at] anzio
company e-mail: rsi [at] anzio
voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
fax: (US) 503-624-0760
web: http://www.anzio.com
street address: Rasmussen Software, Inc.
10240 SW Nimbus, Suite L9
Portland, OR 97223 USA
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


cmadams at hiwaay

Jun 26, 2012, 1:09 PM

Post #3 of 5 (933 views)
Permalink
Re: Modify $TERM from config [In reply to]

Once upon a time, Bob Rasmussen <ras [at] anzio> said:
> Perhaps the answer to this is to bring forward a concept from the telnet
> protocol, into SSH. When a telnet client connects, it doesn't just say
> "I am TERM=ABC". Instead there is an option negotiation process defined.
> So if the server responds "I don't know what terminal ABC is", the client
> can try "I am TERM=XYZ". This process can continue until the client
> decides what is the best fit, and tells the host.

That would be cool. However, I'm trying to deal with hosts that are not
as up-to-date already (e.g. have a smaller terminal database), so a new
extension would unfortunately not help me much (since those same hosts
would probably not support it for years).

--
Chris Adams <cmadams [at] hiwaay>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


mike at pair

Jun 26, 2012, 1:30 PM

Post #4 of 5 (933 views)
Permalink
Re: Modify $TERM from config [In reply to]

On Tue 26 Jun 2012 04:09:05 PM EDT, Chris Adams wrote:
> Once upon a time, Bob Rasmussen <ras [at] anzio> said:
>> Perhaps the answer to this is to bring forward a concept from the telnet
>> protocol, into SSH. When a telnet client connects, it doesn't just say
>> "I am TERM=ABC". Instead there is an option negotiation process defined.
>> So if the server responds "I don't know what terminal ABC is", the client
>> can try "I am TERM=XYZ". This process can continue until the client
>> decides what is the best fit, and tells the host.
>
> That would be cool. However, I'm trying to deal with hosts that are not
> as up-to-date already (e.g. have a smaller terminal database), so a new
> extension would unfortunately not help me much (since those same hosts
> would probably not support it for years).

I've usually handled this with some code in my ~/.bashrc that just
changes and re-exports the TERM variable early on, if it looks like one
that that host doesn't support. I've done this in an ad-hoc way, so I
don't have some nice universal thing to share, but, for example:

[[ "${TERM}" == "rxvt-unicode-256color" ]] \
&& export TERM="rxvt-unicode"

I'm sure there's something that can be done with some terminfo command
or something. I think someone mentioned handling different LANG
settings, and I do that this way:

if [[ -x "$(type -P locale)" ]] ; then
case "`locale -a`" in
*en_US.UTF-8*)
LANG="en_US.UTF-8"
;;
*en_US.utf8*)
LANG="en_US.utf8"
;;
*en_US*)
LANG="en_US"
;;
esac
[[ -n "${LANG}" ]] && export LANG SUPPORTED="${LANG}:en_US:en"
fi

--
Mike Kelly
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


christophe at garault

Jun 26, 2012, 1:57 PM

Post #5 of 5 (933 views)
Permalink
Re: Modify $TERM from config [In reply to]

On 26/06/2012 20:40, Chris Adams wrote :
> I don't see a way to override $TERM for a particular host in
> ~/.ssh/config.
I'm not sure if this could help you, but you could allow the
PermitUserEnvironment in the sshd conf of that host and then change the
authorized_keys accordingly:
environment="TERM=xterm-256color" before the key itself.

Hth.

--
Christophe Garault
Attachments: smime.p7s (5.25 KB)

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.