Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Connect to AWS instance using Putty

Posted on 2013-06-06
14
Medium Priority
?
604 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In the wake of AWS' S3 outage, we want to discuss the importance of storage and data diversification in the event of a hack, crash, or system disruption. We spoke with Experts Exchange’s COO Gene Richardson for a deeper understanding.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

704 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