After you get acess to your EC2 instance via the default EC2 certificates (which you can via your AWS admin panel) using usually “ubuntu” as login name you might have to grant access to any external guy, like a web designer.
It’s not a good practise to enable password access but SSH-Keys. As this is the second time I have lost 1.5h searching for how to do this, I am detailing it here.
*on your local machine*
$ cd ~/.ssh
$ ssh-keygen -b 1024 -t dsa
Give a suitable name to your new certificate file and a password. This will generate two file, which one of them is a public key (smartly enough is the one ending in .pub).
Copy this file, let’s call it my_public_certificate.pub, to your remote EC2 instance server and append it to authorized_keys file.
*in your remote machine (EC2 instance)*
$cat my_public_certificate.pub >> /home/your_web_designer_directory/.ssh/authorized_keys
Now the *tricky* part: ensure the following directory/file permissions:
$chown 755 your_web_designer:your_web_designer /home/your_web_designer_directory
$chown 700 your_web_designer:your_web_designer /home/your_web_designer_directory/.ssh
$chown 600 your_web_designer:your_web_designer /home/your_web_designer_directory/.ssh/authorized_keys
*back on your local machine*
$ssh your_web_designer@remote_machine_IP -i ~/.ssh/my_private.certificate (not the public, hein!)
Home it saves same hour or two to anyone…
http://blog.taggesell.de/index.php?/archives/73-Managing-Amazon-EC2-SSH-login-and-protecting-your-instances.html
http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=100&externalID=1233
http://www.slackbook.org/html/essential-sysadmin-hardusers.html
