Skip to content

Instantly share code, notes, and snippets.

@akehoyayoi
Created September 22, 2017 00:12
Show Gist options
  • Save akehoyayoi/b044859aae205e502e2a7ea85e7fad57 to your computer and use it in GitHub Desktop.
Save akehoyayoi/b044859aae205e502e2a7ea85e7fad57 to your computer and use it in GitHub Desktop.
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_prepare_authorized_keys":
mode: "000777"
content: |
ARRAY=(
https://github.com/akehoyayoi.keys # アクセスできるようにしたいアカウントを列挙しておく
)
echo 'ssh-rsa 元々あったauthorized_keyを書いておく' > authorized_keys
for item in ${ARRAY[@]}; do
curl $item >> authorized_keys
done
cp authorized_keys /home/ec2-user/.ssh/authorized_keys
chown ec2-user /home/ec2-user/.ssh/authorized_keys
chmod 600 /home/ec2-user/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment