Skip to content

Instantly share code, notes, and snippets.

@mingderwang
Created August 16, 2011 06:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mingderwang/1148521 to your computer and use it in GitHub Desktop.
Save mingderwang/1148521 to your computer and use it in GitHub Desktop.
add a public key for new host to ssh aws ec2
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