SSH忽略我的ForwardAgent配置?

uca*_*ion 8 ssh

我正在尝试为我正在处理的webapp设置Capistrano,而我无法让代理转发工作.

这是我的~/.ssh/config:

Host rs
Hostname <ip of my server>
  ForwardAgent yes

User root
Run Code Online (Sandbox Code Playgroud)

而且我认为默认设置不会覆盖任何内容,因为ForwardAgent在那里从未提及(除了注释行).

这是我正常SSH时会发生的事情:

$ ssh -v deploy@<server>
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/ulyssecarion/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *

-- snip --

debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic x86_64)
Run Code Online (Sandbox Code Playgroud)

如果我强制SSH允许使用该-A标志进行代理转发,那么我可以使其工作:

$ ssh -Av deploy@<server>
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/ulyssecarion/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *

-- snip --

debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Requesting authentication agent forwarding. # Note this additional line here
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic x86_64)
Run Code Online (Sandbox Code Playgroud)

(请注意,第二个示例中的日志有一条额外的行,表示正在请求代理转发.)

这是正常的,还是我做错了什么?提前致谢!

che*_*ner 14

这个块

Host rs
  HostName <ip of my server>
  ForwardAgent
  User root
Run Code Online (Sandbox Code Playgroud)

仅适用于您的电话ssh看起来像

ssh rs
Run Code Online (Sandbox Code Playgroud)

在这种情况下ssh知道应该用来代替"rs".在你的电话里

ssh -v deploy@<server>
Run Code Online (Sandbox Code Playgroud)

无论你使用什么,因为<server>不匹配"rs"(因为只有文字字符串"rs"将匹配),所以该块不适用.

Host选项的参数必须是与您在命令行上实际使用的主机名匹配的模式.