Solved

Connect to AWS instance using Putty

Posted on 2013-06-06
14
549 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 6

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 6

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
 
LVL 6

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 6

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
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
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 500 total points
ID: 39225774
I suggest blowing it away and starting a new one, it should take no more than 5 minutes.
0
 
LVL 6

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now