q8z1rg
Last Updated: March 14, 2016
·
5.768K
· akalyaev
D83b63db79b42978fe35e120550ca180

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.

Say Thanks
Respond

2 Responses
Add your response

7515
0ca8515ca904d986789d68e1216fa56b

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
Bluewhite   shrt

Thanks, nisaacson!

over 1 year ago ·
Filed Under