Skip to content

Instantly share code, notes, and snippets.

@pahud
Last active February 20, 2023 13:14
Show Gist options
  • Save pahud/03384330851124713105 to your computer and use it in GitHub Desktop.
Save pahud/03384330851124713105 to your computer and use it in GitHub Desktop.
temporarily add your SSH public key on Amazon Linux in User Data file
#!/bin/bash
cat >> ~ec2-user/.ssh/authorized_keys << EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0QIiv+QYlGIlBc6FFNMQ1WDWfqV2DrpxK2owdDCXsofIoMEhR+QUU4crJ6sNrIe7hMtYbT8c8t487zZHqPbiktjH3rhDq5soeKpUpbcQAbVo9eIC5y4nSr4FoPxonhF0vF0e7keTzquoAVWGYzyyLqsTN8AuJ0aHpsuWrJSLRNoPE/jYkM+gQjp3qecKlgZ1WxOokBGzebufUhszBYwGCD0CT4iKiU4HIQXf+einBq/cEJvtDX5bbttsfaU4pPZ2EjM37o2RTzHpyzO42fn6nHi01Hw2xInPiEGlmwQGV1EK9hA7S77ZriYaVlWEsKWNsBfcjbkS3J4J+UMJBoxFB pahud@pahud-mb12.2016
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment