Forwarding SSH keys to a Vagrant box

Scenario: A new Linux box has been installed with Vagrant, and now I must git clone a non-open repository to the server, so I need to forward my SSH keys to the root user on the virtual server.

1) Add the following line to your Vagrantfile:
config.ssh.forward_agent = true

2) Once you’ve “vagrant ssh”‘d to the server:
$ sudo -E -s su become root with your forwarded key.

I found the answers at Stackoverflow and Serverfault, and decided to copy them here so I don’t need to Google them the next time I’m looking for the answers.

Categorized as IT

Leave a comment

Your email address will not be published. Required fields are marked *