Revisions
-
ursuad revised this gist
Apr 17, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,7 @@ def authorize_key_for_root(config, *key_paths) run: 'once', inline: "echo \"Creating /root/.ssh/authorized_keys with #{key_path}\" && " + 'mkdir -p /root/.ssh/ && ' + 'rm -f /root/.ssh/authorized_keys && ' + 'mv /home/vagrant/root_pubkey /root/.ssh/authorized_keys && ' + 'chown root:root /root/.ssh/authorized_keys && ' + -
maxim created this gist
Jun 13, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ def authorize_key_for_root(config, *key_paths) [*key_paths, nil].each do |key_path| if key_path.nil? fail "Public key not found at following paths: #{key_paths.join(', ')}" end full_key_path = File.expand_path(key_path) if File.exists?(full_key_path) config.vm.provision 'file', run: 'once', source: full_key_path, destination: '/home/vagrant/root_pubkey' config.vm.provision 'shell', privileged: true, run: 'once', inline: "echo \"Creating /root/.ssh/authorized_keys with #{key_path}\" && " + 'rm -f /root/.ssh/authorized_keys && ' + 'mv /home/vagrant/root_pubkey /root/.ssh/authorized_keys && ' + 'chown root:root /root/.ssh/authorized_keys && ' + 'chmod 600 /root/.ssh/authorized_keys && ' + 'rm -f /home/vagrant/root_pubkey && ' + 'echo "Done!"' break end end end