问题原文
原帖链接 · raphink · CC BY-SA 3.0
In ssh_config, one can choose to export some environment variables to the host using SendEnv.
Is there also a way to force a given value for this variable, per host? For example, would it be possible to export variable $FOO with value bar only when connecting to host example.com?
社区高分解答
原帖链接 · kenorb · CC BY-SA 4.0
You can give a specific value by using SetEnv in your ~/.ssh/config, e.g.
Host *
SetEnv FOO=bar
As per man ssh_config:
Directly specify one or more environment variables and their contents to be sent to the server. Similarly to
SendEnv, the server must be prepared to accept the environment variable.
Assuming your server got the following line in /etc/ssh/sshd_config:
AcceptEnv LANG LC_* FOO
Check also: man ssh_config and man sshd_config.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
