-
-
Save mingderwang/1148521 to your computer and use it in GitHub Desktop.
add a public key for new host to ssh aws ec2
This file contains 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
1. make a new public on local host (generate public key under ~/.ssh) | |
cd | |
ssh-keygen -t rsa -b 1024 | |
2. copy the output of the following cat. | |
cat ~/.ssh/id_rsa.pub | |
3. ssh to your aws ec2 and paste it to ~/.ssh/authorized_keys2 (a new file) | |
4. chmod 640 ~/.ssh/authorized_keys2 | |
5. go back to your local host and try to ssh it. | |
make sure the username is the same as the one you put public key on it's ~/.ssh directory. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment