Last active
May 24, 2022 08:19
-
-
Save hongsw/dde616f5d43f71ae4fda247e559cbe89 to your computer and use it in GitHub Desktop.
Add a new authorized key to an AWS EC2 instance by a new .pem file
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 characters
chmod 400 new.pem | |
ssh-keygen -y -f new.pem > new.pub | |
cat ./new.pub | ssh -i old.pem USER@HOST "cat >> ~/.ssh/authorized_keys" | |
# Test | |
ssh -i new.pem USER@HOST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you went to add a new user and .pem file at one time,