Created
July 9, 2015 07:15
-
-
Save amosshapira/7b041a8ac53c39e10414 to your computer and use it in GitHub Desktop.
Restore Vagrant authorized_keys on a Vagrant box
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 | |
MACHINE=$1 | |
# Assume executing in the directory of the Vagrant file | |
# This command will prompt for the Vagrant user's password, it's usually "vagrant" | |
ssh-keygen -y -f .vagrant/machines/$MACHINE/virtualbox/private_key | \ | |
vagrant ssh $MACHIME -c "mkdir .ssh; tee -a .ssh/authorized_keys; chmod 0600 .ssh/authorized_keys" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment