如何设置Vagrant ssh代理转发? [英] How to setup Vagrant ssh agent forwarding?

查看:164
本文介绍了如何设置Vagrant ssh代理转发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是使用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):


  1. 从主机登录到VM(使用--debug时,我看到转发已启用)

  1. Log from the host machine to VM (when I use --debug, I see that the forwarding is enabled)


无用的ssh

vagrant ssh


  • 从VM登录(ubuntu 12.04,注入了无用的ssh键)到外部计算机

  • Log from VM (ubuntu 12.04 with injected vagrant ssh key) to external machine


    ssh -A sk@192.168.0.1
    


    获取:权限被拒绝。

    是否需要执行其他任何步骤才能使其正常工作?人们建议使用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:


    1. 登录到VM: vasrant ssh

    2. 在VM上生成新的ssh密钥: ssh-keygen

    3. 将新的公共ssh上载到192.168.0.1:我手动完成。它可以自动化。

    4. ssh -A sk@192.168.168.0.1 有效

    1. Log to the VM: vagrant ssh
    2. Generate a new ssh key on the VM: ssh-keygen
    3. Upload the new public ssh to 192.168.0.1: I do it manually. It could be automatize.
    4. ssh -A sk@192.168.168.0.1 works

    这篇关于如何设置Vagrant ssh代理转发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆