SSH ProxyCommand问题 [英] Problems with SSH ProxyCommand
问题描述
我的ssh proxycommand有一些问题.代理上的身份验证工作正常,但是当我要登录到远程主机时,它将失败.问题似乎是,代理尝试使用我的本地rsa_key而不是使用存储在代理上的密钥登录.有办法解决这个问题吗?
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?
本地-本地rsa->代理-代理rsa->主机
Local -- local rsa --> Proxy -- proxy rsa --> host
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
推荐答案
问题似乎是,代理尝试使用我的本地rsa_key而不是使用存储在代理上的密钥登录.
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.
是的.是的这是设计使然.您不想将私钥复制到代理. 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.
有两种方法:
-
将密钥复制到本地主机,并将其配置为使用.
Copy the key to your local host and configure it to be used.
不要使用ProxyCommand
并执行简单的ssh
:
Don't use ProxyCommand
and do the simple ssh
:
ssh -t proxy ssh host
它将使用第二个主机的身份验证
it will use the authentication from the second host
这篇关于SSH ProxyCommand问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!