Last active
August 29, 2015 14:04
-
-
Save zouzias/705c13f2242b79f2608e to your computer and use it in GitHub Desktop.
Vagrant:Copy ssh private ssh key to all virtual machines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Iterate over all listening ssh ports of all VMs | |
for VM_PORT in `vagrant ssh-config | grep Port | awk '{ print $2}'` | |
do | |
echo "Copying ~/.vagrant.d/insecure_private_key to host with ssh listening on port ${VM_PORT}" | |
scp -i ~/.vagrant.d/insecure_private_key -P ${VM_PORT} ~/.vagrant.d/insecure_private_key vagrant@localhost:~/.ssh/id_rsa | |
done | |
# Now, each pair of vms communicates with each other. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment