May 11, 2012 - Warren Held

Linux: SSH Using A Key Pair

To manage my Amazon EC2 instance (what this website runs on), I have been using Putty for Windows. At work I use Ubuntu Linux with a Windows 7 VM (because I need to use some Windows apps for work), and I decided it would be a lot easier to SSH into my EC2 instance using my Ubuntu Linux instead of Putty in Windows. This is how to get SSH to authenticate with a key pair:

Step 1:
Copy your key into ~/.ssh (the hidden .ssh folder inside your home folder).

Step 2:
Restrict the permissions on the key so only your user has read and write access (otherwise SSH will reject the key).
[bash]sudo chmod 600 (your key file name)[/bash]

Step 3:
Connect via SSH using the key. In my case I ran:
[bash]ssh -i ~/.ssh/AmazonEC2Key1.pem ec2-user@warrenheld.com[/bash]

Linux Linux / SSH /