调用ssh时可以更改$ TERM的值吗?

在我的本地terminal上,我有TERM = konsole-256color,但不是我连接的所有远程机器都有这个定义。

是否有可能使ssh在远程机器上更改TERM? 不用在远程机器上更改.bash *脚本,只需更改本地桌面上的configuration?

TERM=vt100 ssh some.host.name 

在远程,执行echo $ TERM

男人ssh:

  ssh reads ~/.ssh/environment, and adds lines of the format “VARNAME=value” to the environment if the file exists and users are allowed to change their environment. For more information, see the PermitUserEnvironment option in sshd_config(5). 

编辑:

大鼠,我希望可以在本地,如果有意愿的话,还是有办法的。 man ssh_conf:

 SendEnv Specifies what variables from the local environ(7) should be sent to the server. Note that environment passing is only supported for protocol 2. The server must also support it, and the server must be configured to accept these environment variables. Refer to AcceptEnv in sshd_config(5) for how to configure the server. Variables are specified by name, which may contain wildcard char- acters. Multiple environment variables may be separated by whitespace or spread across multiple SendEnv directives. The default is not to send any environment variables. 

根据接收端sshd的configuration情况,可能会满足或不满足“无远程文件修改”的要求。

这是我刚刚扔在一起的快速和肮脏的解决scheme。 我更喜欢更好的东西。 我想我可以使用一个shell脚本。 调整TERM值是对读者的一个练习。

 # To move into a separate plugin... function ssh { if [[ "${TERM}" = screen* || konsole* ]]; then env TERM=screen ssh "$@" else ssh "$@" fi } 

理想情况下,它会做类似于检查另一端的TERM,使用ControlPersist东西来防止多个连接的长时间延迟。

我已经将下面的别名添加到我的.bashrc文件中。 它使用OG的答案,但包装在一个别名。 奇迹般有效 ;)

 # Force xterm-color on ssh sessions alias ssh='TERM=xterm-color ssh'