Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add SSH key as authorized key for Vagrant's root
Vagrant.configure(2) do |config|
...
id_rsa_pub = File.read("#{Dir.home}/.ssh/id_rsa.pub")
config.vm.provision "copy ssh public key", type: "shell",
inline: "echo \"#{id_rsa_pub}\" >> /home/vagrant/.ssh/authorized_keys"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment