[opensuse] Different TERM for ssh and xterm?
Hi, can I have a different TERM setting for ssh and xterm? For ssh (putty) I need TERM = linux to have all the linedraw signes and F-keys working right. In local xterms I need TERM = xterm. Is there a way to fix this without changing TERM manually everytime I log in or open a xterm? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tuesday 07 February 2012, Andreas wrote:
Hi, can I have a different TERM setting for ssh and xterm?
For ssh (putty) I need TERM = linux to have all the linedraw signes and F-keys working right. In local xterms I need TERM = xterm.
Is there a way to fix this without changing TERM manually everytime I log in or open a xterm?
Can't putty export variables somehow? Quick and dirty you could set in ~/.profile something like if test -n "$SSH_TTY" ;then export TERM=linux fi But do you want this if you ssh from xterm? cu, Rudi -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2/7/2012 4:00 PM, Andreas wrote:
Hi, can I have a different TERM setting for ssh and xterm?
For ssh (putty) I need TERM = linux to have all the linedraw signes and F-keys working right. In local xterms I need TERM = xterm.
Is there a way to fix this without changing TERM manually everytime I log in or open a xterm?
TERM must be set to whatever your terminal IS. xterms (local or otherwise) are xterm terminals. So for them, TERM must be set to xterm or one of the various variants like xterm-color etc depending on the specific behavior you want and the specific setting you may have set in xterm command line options, environment variables, and x resources. Putty may emulate a number of different terminals, including both xterm and linux. There is no single correct value for TERM. Rather if you configure all of putty's settings such that it's emulating a linux console, the you need TERM to say "linux". If you set all of putty's settings such that it emulates an xterm, then TERM needs to also say xterm. Putty's default settings are more or less xterm, and by default it sets TERM to xterm. Which is correct but there is more to it than that. There are also the problems of character sets and fonts and unicode. If the host is using utf8, then you need to tell putty to do so before the line-draw characters will work. You could also go through and create a saved session that's all configured for linux instead of xterm. Part of that config would be to put "linux" in the Terminal Type String under the Connection -> Data section. I will assume your server expects unicode since that is generally the default for some years now. That may or may not be your case (yast -> System -> Language -> Details) but I have to assume something in order to proceed any further. So given that assumption I would do this: putty config: Terminal Keyboard Backspace Ctrl-? Home/end Standard Function keys Linux Window Appearance Font Lucida Console Translation Char set translation UTF-8 line drawing: Use Unicode Connection Data Terminal-type string: linux Then go back to the Session page at the top and fill in the address and pick a name and save the session. The Terminal-type string tells putty to set the TERM variable to that value ("linux"). Your /etc/sshd_config needs to allow this, and the default config does. And you need to not be overwriting TERM with any hard-coding hacks in .profile or such. TERM should always be set by the client, never by TERM=something in any scripts on the server, except in the few cases where that's not possible, which is just serial ports, and even serial ports have methods to automate TERM but it's an involved topic of it's own and I'd need you to say you cared about it before wasting that much time on it. The particular connection method, be it telnet or ssh or serial or other, does not affect what is the correct value for TERM. -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2/7/2012 5:23 PM, Brian K. White wrote:
The Terminal-type string tells putty to set the TERM variable to that value ("linux"). Your /etc/sshd_config needs to allow this, and the default config does. And you need to not be overwriting TERM with any
correcting myself: /etc/ssh/sshd_config -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am 07.02.2012 23:23, schrieb Brian K. White:
On 2/7/2012 4:00 PM, Andreas wrote:
Hi, can I have a different TERM setting for ssh and xterm?
For ssh (putty) I need TERM = linux to have all the linedraw signes and F-keys working right. In local xterms I need TERM = xterm.
Is there a way to fix this without changing TERM manually everytime I log in or open a xterm?
TERM must be set to whatever your terminal IS.
xterms (local or otherwise) are xterm terminals. So for them, TERM must be set to xterm or one of the various variants like xterm-color etc depending on the specific behavior you want and the specific setting you may have set in xterm command line options, environment variables, and x resources.
Putty may emulate a number of different terminals, including both xterm and linux. There is no single correct value for TERM. Rather if you configure all of putty's settings such that it's emulating a linux console, the you need TERM to say "linux". If you set all of putty's settings such that it emulates an xterm, then TERM needs to also say xterm.
Putty's default settings are more or less xterm, and by default it sets TERM to xterm. Which is correct but there is more to it than that. There are also the problems of character sets and fonts and unicode. If the host is using utf8, then you need to tell putty to do so before the line-draw characters will work.
You could also go through and create a saved session that's all configured for linux instead of xterm. Part of that config would be to put "linux" in the Terminal Type String under the Connection -> Data section.
I will assume your server expects unicode since that is generally the default for some years now. That may or may not be your case (yast -> System -> Language -> Details) but I have to assume something in order to proceed any further.
So given that assumption I would do this:
putty config: Terminal Keyboard Backspace Ctrl-? Home/end Standard Function keys Linux
Window Appearance Font Lucida Console Translation Char set translation UTF-8 line drawing: Use Unicode
Connection Data Terminal-type string: linux
Then go back to the Session page at the top and fill in the address and pick a name and save the session.
The Terminal-type string tells putty to set the TERM variable to that value ("linux"). Your /etc/sshd_config needs to allow this, and the default config does. And you need to not be overwriting TERM with any hard-coding hacks in .profile or such. TERM should always be set by the client, never by TERM=something in any scripts on the server, except in the few cases where that's not possible, which is just serial ports, and even serial ports have methods to automate TERM but it's an involved topic of it's own and I'd need you to say you cared about it before wasting that much time on it.
The particular connection method, be it telnet or ssh or serial or other, does not affect what is the correct value for TERM.
Thanks a lot for taking the time to give the detailed description. :) That works nicely. Regards Andreas -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (3)
-
Andreas
-
Brian K. White
-
Ruediger Meier