Problems with SSH ProxyCommand

佐手、 提交于 2019-12-22 09:46:29

问题


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:


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



来源:https://stackoverflow.com/questions/38382659/problems-with-ssh-proxycommand

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!