【问题标题】:Unsetting parameters for specific hosts in SSH config在 SSH 配置中取消设置特定主机的参数
【发布时间】:2012-01-28 18:23:16
【问题描述】:

.ssh/config 中,我为给定域中的所有主机设置了RemoteForward

Host *.[domain]
   RemoteForward [remote-port] 127.0.0.1:[local-port]

如何为该域中的特定主机取消设置该参数(例如,git.[domain])?

【问题讨论】:

  • ssh_config 手册页提到使用否定来排除某些主机,但仅适用于 .ssh/authorized_keys 中的键。在.ssh/config 中尝试过类似的组合,但没有骰子
  • 从手册页我希望Host !git.[domain],*.[domain] 做你想做的事。您尝试过哪些组合?

标签: ssh openssh


【解决方案1】:

尝试 ClearAllForwardings 设置:

Host *.[domain]
   RemoteForward [remote-port] 127.0.0.1:[local-port]

Host git.[domain]
   ClearAllForwardings yes

git 不会像 scp 和 sftp 那样自动设置 ClearAllForwardings=yes 吗?

【讨论】:

  • 好像没有。我在~/.ssh/config 之上设置了RemoteForward 52698 127.0.0.1:52698 以在所有域上使用rsub,但随后在连接到GitHub 时开始获取Warning: remote port forwarding failed for listen port 52698(因为它显然不允许转发端口)。在Host github.com 下使用ClearAllForwardings=yes,错误消失了。
猜你喜欢
  • 2016-11-13
  • 1970-01-01
  • 2018-01-11
  • 2011-07-06
  • 1970-01-01
  • 1970-01-01
  • 2018-10-07
  • 2023-03-23
  • 1970-01-01
相关资源
最近更新 更多