简体   繁体   中英

How do I automatically migrate the host's SSH public key to my Puppet-based Vagrant Virtual Machine

Is there a way to migrate my Host's public ssh key to my VM? The use case is:

I have a user who has a public SSH key which has access to a certain repository. I am creating a VM that will be distributed to other developers (who have access with their SSH keys to this repository) I would like to automate git cloning of the repository so it happens during exec-once .. What should I do that involves as few manual paths as possible?

PS: I am using https://puphpet.com/ to generate the vagrant machine for me - I am not editing the Vagrantfile direclty.

As mentioned in comments you can use a vagrant file provision to copy your private key on your VM

in your Vagrantfile add

Vagrant.configure("2") do |config|
  # ... other configuration

  config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/home/vagrant/id_rsa.pub"
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM