Solved

Connect to AWS instance using Putty

Posted on 2013-06-06
14
584 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
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!

 
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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Integrating Amazon Alexa,  google sheet, and Twilio msg 2 80
Apache module 5 87
simple bash script needed to unpack tar.gz 4 62
bash: ./Facebooker.pl :Permission Denied 9 54
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
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, fr…

751 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