SSH代理转发

3

我正在试图在运行Mountain Lion的MacBook Air上设置代理转发。

在本地,我可以运行ssh -T git@github.com,并成功连接到Github。

当我尝试通过ssh连接到我的服务器并运行ssh -T git@github.com时,它显示权限被拒绝。

这是~/.ssh/config文件:

Host <my host>
  ForwardAgent yes

ssh -v <我的服务器> 的输出结果

debug1: Reading configuration data /Users/tombleymaier/.ssh/config
debug1: /Users/tombleymaier/.ssh/config line 1: Applying options for <host>
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to <host> [<ip>] port 22.
debug1: Connection established.

/etc/ssh_config (第20行及以上)

 Host *
   SendEnv LANG LC_*
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com

我在另一台安装Mountain Lion的MacBook上也没有遇到任何问题。


一旦您连接到服务器,您是否拥有与本地相同的密钥(~/.ssh/id_rsa~/.ssh/id_rsa.pub)?如果您在SSH连接到服务器时没有这些密钥,则无法完成与GitHub的SSH连接。 - VonC
1
@VonC - 我认为转发代理的重点在于密钥不必安装在中间机器上,是吗? - Tyler DeWitt
好的,我刚刚重新阅读了http://www.codegnome.com/blog/2012/08/26/remote-forwarding-with-ssh-and-git-daemon/。在您的服务器上执行`ssh -Tvvv git@github.com`返回什么? - VonC
1个回答

5

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接