Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Connect to AWS instance using Putty

Posted on 2013-06-06
14
Medium Priority
?
610 Views
Last Modified: 2014-11-12
I followed these steps here to try to connect to a AWS Ubuntu instance
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html

but can't get it to work. I have converted the private key using PuttyGen. When I try to connect using the user name as per the link above I get:
key error
0
Comment
Question by:Gerhardpet
  • 5
  • 5
  • 4
14 Comments
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39225537
Did you copy the key to authorized_keys on the linux machine?

This should be done in the /home/username/.ssh directory or if root in the /root/.ssh directory.
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 39225572
No I didn't but I should not have to from what I'm reading on the link above. When creating the instance on AWS  does it not automatically place the key on the Linux machine?

How can I find out if the key is already there.

I'm a total beginner on Linux/Ubuntu
0
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39225582
on the linux machine open terminal then navigate to /home/username/.ssh or /root/.ssh if you are connecting to root.

Open the authorized_keys file and insert the RSA line of code. It should be 1 long line. Once you do that in putty make sure you have selected your private key.

it's under connection > SSH > Auth then click back on Session and click save.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39225620
I don't see in the document where it installs the public key on the server.

So you should have 2 keys, public and private. The private goes with putty then copy and paste the public into the authorized_keys file for the username you are connecting to.

root@linux [~/.ssh]# ll
total 36
drwxr-xr-x  2 root root 4096 May 30 09:00 ./
drwxr-x--- 27 root root 4096 Jun  6 09:46 ../
-rw-r--r--  1 root root 1219 May 30 09:00 authorized_keys
-rw-------  1 root root 1675 Jan 17  2011 id_rsa
-rw-r--r--  1 root root  406 Jan 17  2011 id_rsa.pub
-rw-r--r--  1 root root 7015 May  3 10:09 known_hosts
root@linux [~/.ssh]#

Open in new window


vim authorized_keys

Open in new window


Press the "i" key to insert
then copy and paste the public key into the file

Press this key sequence to save:
:wq

Open in new window


Then try your SSH connection.
0
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39225636
note: you will have to log into the server with a username/password until the key is in place.
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39225697
In your aws conole, you should be able download the private key - <username>.pem and use it for first time ssh connection. Key pair is done during the ec2 configuration. After you got your private key, attach it to your putty client along with a usernasme.
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 39225704
@rsaylor
note: you will have to log into the server with a username/password until the key is in place.

I'm not able to connect with a username and password. The only way to connect right now is with the Java SSH Client form the AWS management console.

Under key pair in the AWS management console I'm only be able to download the private key so I don't know where to get the public key
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 39225713
@Mazdajai
In your aws conole, you should be able download the private key - <username>.pem and use it for first time ssh connection. Key pair is done during the ec2 configuration. After you got your private key, attach it to your putty client along with a usernasme.

That is what I'm doing but it does not work. I get this message/error

putty auth problem
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39225741
Is this a brand new ec2 instance?
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 39225746
Is this a brand new ec2 instance?
Yes
0
 
LVL 21

Accepted Solution

by:
Mazdajai earned 2000 total points
ID: 39225774
I suggest blowing it away and starting a new one, it should take no more than 5 minutes.
0
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39225785
I agree the machine needs re-loaded if it's brand new should not take long to re-image.
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39225828
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 39225861
Ok it is working now. I was missing one small step.

When using the Java SSH client it gives me the user name which I had not noticed before. So I was trying with "ec2-user" as per this here from the link above

In the SSH session window, log in with the appropriate username. In most cases, the username will be ec2-user. No password is required because the authentication is provided by the selected public/private key pair.


Now I want to find out how to connect to the desktop GUI using VNC viewer. I will post a new question if I can't get it to work.

Thanks for all the help
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
As managed cloud service providers, we often get asked to intervene when cloud deployments go awry. Attracted by apparent ease-of-use, flexibility and low computing costs, companies quickly adopt leading public cloud platforms such as Amazon Web Ser…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question