问题

问题

据我所知,SSH 登录后将执行以下文件

[SERVER] /etc/environment

[Client] ~/.ssh/environment
-> can be locally overriden by "SSH_ENV" environment variable
-> will override Host=>SendEnv in local ~/.ssh/config
-> will be filtered by "AcceptEnv" directive(s) in remote /etc/ssh/sshd_config
-> will NOT be used if "PermitUserEnvironment no" in remote /etc/ssh/sshd_config

[SERVER] /etc/ssh/sshrc         
-> will NOT get executed if "ForceCommand" exists in remote /etc/ssh/sshd_config
-> will NOT get executed if local ~/.ssh/rc exists
-> can be overriden by "ForceCommand" (kind of)

[Client] ~/.ssh/rc              
-> will NOT get executed if "ForceCommand" is configured
-> can be overriden by local "???" environment variable?

问题

我如何强制在服务器上执行脚本但仍允许客户端使用他的脚本~/.ssh/rc

附加问题

是否可以~/.ssh/rc使用环境变量覆盖本地位置?如果可以,覆盖哪一个?

答案1

解决方案似乎是评估

SSH_原始命令

~/.ssh/rc环境变量被设置为客户端脚本中的命令,配置为部队指挥

我发现这个可能的解决方案这个答案


其余的:有没有办法~/.ssh/rc使用环境变量覆盖位置?

相关内容