Skip to content
Snippets Groups Projects
Commit 1948f186 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Setup vagrant to use existing ssh key

Set insert_key to false, prevent vagrant from generating new key
then set our own ssh private key to be used, first priority
finally, copy our own ssh public key into vm as authorized key
parent 41e13514
No related branches found
No related tags found
1 merge request!11Feat copy ssh key to vm
...@@ -22,12 +22,15 @@ Vagrant.configure("2") do |config| ...@@ -22,12 +22,15 @@ Vagrant.configure("2") do |config|
auto_correct: true auto_correct: true
end end
config.vm.provider :virtualbox do |vb| config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.memory = "2048" vb.memory = "2048"
end end
config.ssh.insert_key = false
config.ssh.private_key_path = ["~/.ssh/id_rsa", "~/.vagrant.d/insecure_private_key"]
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
config.vm.provision "shell", inline: <<-SHELL config.vm.provision "shell", inline: <<-SHELL
if [ -f /vagrant/localenv.sh ]; then if [ -f /vagrant/localenv.sh ]; then
. /vagrant/localenv.sh . /vagrant/localenv.sh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment