Skip to content

Instantly share code, notes, and snippets.

@amosshapira
Created July 9, 2015 07:15
Show Gist options
  • Select an option

  • Save amosshapira/7b041a8ac53c39e10414 to your computer and use it in GitHub Desktop.

Select an option

Save amosshapira/7b041a8ac53c39e10414 to your computer and use it in GitHub Desktop.

Revisions

  1. amosshapira created this gist Jul 9, 2015.
    8 changes: 8 additions & 0 deletions restore-vagrant-key
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/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"