我試圖登錄到我的服務器拋出一個堡壘主機和我的配置文件是這樣的:SSH不能與「-F」合作,通過一個堡壘主機登錄
Host 10.10.10.1
User ec2-user
ProxyCommand ssh -W %h:%p xxx.xxx.xxx.xxx
IdentityFile key.pem
Host xxx.xxx.xxx.xxx
User ec2-user
IdentityFile key.pem
ForwardAgent yes
它工作正常,如果我救這個配置在〜/ .ssh中,名稱爲「config」,這是ssh的默認配置文件。我可以「的ssh -v 10.10.10.1」登錄和DEBUGLOG是這樣的:
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data ~/.ssh/config
debug1: /Users/twer/.ssh/config line 2: Applying options for 10.10.10.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Executing proxy command: exec ssh -W 10.10.10.1:22 xxx.xxx.xxx.xxx
debug1: permanently_drop_suid: 501
debug1: key_load_public: No such file or directory
debug1: identity file key.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file key.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 10.10.10.1:22 as 'ec2-user'
...
但是,如果我保存配置其他地方(刪除在〜/ .ssh的配置),並與「SSH登錄-v -F〜/ mysshconfig 10.10.10.1「,失敗。調試日誌是:
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data ansible-ssh.conf
debug1: ansible-ssh.conf line 1: Applying options for 10.10.10.1
debug1: Executing proxy command: exec ssh -W 10.10.10.1:22 xxx.xxx.xxx.xxx
debug1: permanently_drop_suid: 501
debug1: key_load_public: No such file or directory
debug1: identity file key.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file key.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
Permission denied (publickey).
因爲我想使用ansible,我需要用這個「-F」選項指定一個sshconfig。
謝謝,但它不是一個路徑問題。我已經搞清楚了。 – hsc