问题描述
我的目标是使用ssh密钥身份验证从VirtualBox VM连接到另一台计算机。我已经使用Vagrant(1.0.5)创建了VM。我还启用了config.ssh.forward_agent = true(如)。不幸的是,ssh转发似乎不起作用。
My goal is to connect from a VirtualBox VM to another machine using the ssh key authentication. I have created the VM with Vagrant (1.0.5). I have also enabled config.ssh.forward_agent = true (as suggested in this post). Sadly, the ssh forwarding does not seem to be working.
以下是这些步骤(在带有流浪汉和virtualbox的新鲜ubuntu上):
These are the steps (on fresh ubuntu with vagrant and virtualbox):
-
从主机登录到VM(使用--debug时,我看到转发已启用)
Log from the host machine to VM (when I use --debug, I see that the forwarding is enabled)
从VM登录(ubuntu 12.04,注入了无用的ssh键)到外部计算机
Log from VM (ubuntu 12.04 with injected vagrant ssh key) to external machine
ssh -A [email protected]
获取:权限被拒绝。
是否需要执行其他任何步骤才能使其正常工作?人们建议使用ssh-add -K。我不清楚在哪台计算机上。
Do I need to perform any additional step to make it work? People advice to use ssh-add -K. It is not clear for me on which machine.
推荐答案
我无法使ssh转发正常工作。我的解决方案是简单地在VM上生成新的ssh密钥:
I could not make the ssh forwarding working. My solution is to simply generate new ssh key on the VM:
- 登录到VM: vasrant ssh
- 在VM上生成新的ssh密钥: ssh-keygen
- 将新的公共ssh上载到192.168.0.1:我手动完成。它可以自动化。
- ssh -A [email protected] 有效
- Log to the VM: vagrant ssh
- Generate a new ssh key on the VM: ssh-keygen
- Upload the new public ssh to 192.168.0.1: I do it manually. It could be automatize.
- ssh -A [email protected] works
这篇关于如何设置Vagrant ssh代理转发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!