Skip to content

Instantly share code, notes, and snippets.

@dtenenba
Last active February 29, 2016 21:05
Show Gist options
  • Save dtenenba/068910d0951718220e9a to your computer and use it in GitHub Desktop.
Save dtenenba/068910d0951718220e9a to your computer and use it in GitHub Desktop.
#!/bin/bash
# does not use keypairs yet (see https://discourse.chef.io/t/test-kitchen-ssh-key-for-use-with-vagrant/7892)
# so you will be prompted for the password ('vagrant') once as we add our
# public key to the list of authorized keys.
cat ~/.ssh/id_rsa.pub | ssh -p 2222 vagrant@localhost "cat >> .ssh/authorized_keys"
scp -P 2222 /Users/dtenenba/chef-repo/encrypted_data_bag_secret vagrant@localhost:/tmp
ssh -p 2222 vagrant@localhost "sudo rm -f /etc/chef/encrypted_data_bag_secret && sudo mkdir -p /etc/chef && sudo mv /tmp/encrypted_data_bag_secret /etc/chef/ && sudo chown root /etc/chef/encrypted_data_bag_secret && sudo chmod 0400 /etc/chef/encrypted_data_bag_secret"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment