【问题标题】:SSH config file works globally but not as command line parameterSSH 配置文件全局工作,但不能作为命令行参数
【发布时间】:2017-01-23 20:15:05
【问题描述】:

我已经编写了一个 ssh 配置文件,它指定了一个典型的跳转服务器设置:

Host host1
  HostName 11.11.11.11
  User useroo
  IdentityFile some/key/file


Host host2
  HostName 192.11.11.10
  User useroo
  IdentityFile some/other/key
  ProxyCommand ssh -W %h:%p host1

当我将其保存为~/.ssh/config 时,我可以成功连接ssh host2。但是,如果我将配置保存为xy_conf,调用ssh -F xy_conf host2 会导致错误提示

ssh: Could not resolve hostname host1: Name or service not known
ssh_exchange_identification: Connection closed by remote host

这是预期的行为吗?我还能如何临时设置此配置?我不想设置为~/.ssh/config

OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8,OpenSSL 1.0.1f 2014 年 1 月 6 日

【问题讨论】:

    标签: ssh ubuntu-14.04 openssh


    【解决方案1】:

    ssh_config 使用不同的位置只会影响ssh 的第一次调用,而不影响第二次调用(也来自ProxyCommand). You need to pass the same argument to the secondssh`:

    ProxyCommand ssh -F xy_conf -W %h:%p host1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-02
      • 2022-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-11
      • 1970-01-01
      相关资源
      最近更新 更多