Solved

Connect to AWS instance using Putty

Posted on 2013-06-06
14
562 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Or at least that’s the word according to a new blog from Tech Target on AWS’s new Managed Services (MS) offering. According to the blog, AWS is launching their AWS MS program to expedite the adoption of cloud by Fortune 1000 and Global 2000 companie…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

806 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