q8z1rg
Last Updated: March 14, 2016
·
6.103K
· akalyaev

SSH agent forwarding with Vagrant

If you want to connect over ssh inside a vagrant box like if you were on your host machine, all you need to do is to add this to your Vagrantfile:

config.ssh.forward_agent = true

This will enable agent forwarding for all ssh connections (http://docs.vagrantup.com/v2/vagrantfile/ssh_settings.html).

Thanks to @andreysavelyev for spotting this.

2 Responses
Add your response

7515

If you need ssh forward during provisioning there is a fix available here https://github.com/mitchellh/vagrant/issues/1303#issuecomment-20200018

config.vm.provision :shell do |shell|
    shell.inline = "touch $1 && chmod 0440 $1 && echo $2 > $1"
    shell.args = %q{/etc/sudoers.d/root_ssh_agent "Defaults    env_keep += \"SSH_AUTH_SOCK\""}
end
over 1 year ago ·
19509

Thanks, nisaacson!

over 1 year ago ·