SSH配置文件工作全局但不作为命令行参数
问题描述:
我写了指定一个典型的跳跃服务器设置一个SSH的配置文件: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 host2
连接当我保存这个作为~/.ssh/config
。但是,如果我保存的配置作为其他地方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_config
仅影响ssh
第一个呼叫,而不是第二(从ProxyCommand). You need to pass the same argument to the second
ssh`太:
ProxyCommand ssh -F xy_conf -W %h:%p host1