Is it possible to use a different SSH key for provisioning a VM than for 
everything else?

I want to use a stock vagrant box which uses the default insecure key, so I 
need to use that key to provision the VM. But after provisioning, I don't 
want to use that key ever again. I want to remove it from the VM entirely, 
and use one that I've created beforehand for "vagrant ssh" et al after 
that. That VM will use that key to e.g. connect to github and download 
repositories, so it does need to be one that I've already created, because 
I've already authenticated it to github. (Incidentally, this particular 
problem is compounded by the the fact that it appears to be impossible to 
do interactive provisioning, so I can't create the key on the VM and then 
prompt the user to give it to github before continuing.)

AFAICT, if I specify config.ssh.private_key_path, provisioning can't 
connect to the VM because it tries to use that key which hasn't been set 
yet because I haven't provisioned the machine.

Is this possible? The only way I can think of is to set 
config.ssh.private_key_path in the Vagrantfile and comment it out during 
provisioning, which seems especially hacky. I can't be the only one that 
wants to use my own SSH keys and get rid of the extremely insecure globally 
shared one after provisioning.

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to