Problems with SSH ProxyCommand

2019-05-15 09:58发布

I have some problems with the ssh proxycommand. The authentication on the proxy works fine, but when i want to login to the remote-host it fails. The problem seems to be, that the proxy tries to login with my local rsa_key and not with the key stored on the proxy. Is there a way to fix this?

This is what I want:

Local -- local rsa --> Proxy -- proxy rsa --> host

The Config-file I use:

Host 192.168.178.32
HostName 192.168.178.32
User user
Port 22
IdentityFile ~/.ssh/id_rsa.pub

Host 192.168.178.30
HostName 192.168.178.30
User user
Port 22
IdentityFile home/user/.ssh/id_rsa.pub
ProxyCommand ssh -W %h:%p -F ssh_config -p 22 192.168.178

1条回答
Explosion°爆炸
2楼-- · 2019-05-15 10:47

The problem seems to be, that the proxy tries to login with my local rsa_key and not with the key stored on the proxy.

Yes. It does. It is by design. You don't want to copy private keys over to the proxies. Proxy command will always authenticate from your local host.

There are twa ways out:

  • Copy the key to your local host and configure it to be used.

  • Don't use ProxyCommand and do the simple ssh:

    ssh -t proxy ssh host
    

    it will use the authentication from the second host

查看更多
登录 后发表回答