Skip to content

Instantly share code, notes, and snippets.

@jmserrano-dev
Created May 2, 2018 15:16
Show Gist options
  • Save jmserrano-dev/5b3b2a37634a9af4185cfc202e870b6c to your computer and use it in GitHub Desktop.
Save jmserrano-dev/5b3b2a37634a9af4185cfc202e870b6c to your computer and use it in GitHub Desktop.
#!/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 -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