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.
Written by Anton Kalyaev
Related protips
2 Responses

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
·

Thanks, nisaacson!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ssh
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#