Created
November 5, 2015 17:32
-
-
Save amccarty/2137ae65ddada56c0865 to your computer and use it in GitHub Desktop.
Add public key to vagrant's authorized_keys
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
id_rsa_key_pub = File.read(File.join(Dir.home, ".ssh", "id_rsa.pub")) | |
config.vm.provision :shell, | |
:inline => "echo 'appending SSH Pub Key to ~vagrant/.ssh/authorized_keys' && echo '#{id_rsa_key_pub }' >> /home/vagrant/.ssh/authori | |
zed_keys && chmod 600 /home/vagrant/.ssh/authorized_keys" | |
config.ssh.insert_key = false | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for the useful gist but there is one problem here, you need to add chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys in order for it to work, because with these command the file is owned by root and has 0600 permissions which prevent vagrant user from reading it.