Connect to EC2 instance with PuTTY, server refuses key - amazon-web-services

I have started an EC2 instance that I cannot connect to using PuTTY. I'm using a key pair that I created using PuTTYgen and then imported to AWS. I have specified the private key file on the client side in Connection -> SSH -> Auth. I have SSH on port 22 selected for PuTTY. The EC2 instance has a single security group, and this group has an inbound rule allowing TCP on port 22 from my home laptop's IP address. Still no joy when I try to connect.
In the PuTTY window I see this:
Using username "ec2-user".
Server refused our key
Also an error dialogue box pops up with this message:
Disconnected: No supported authentication methods available (server sent publickey)
What other things should I look into or do differently? I have been successful with this before so I know that it can work, but apparently I've forgotten one or more pieces of the puzzle.

Which Linux distribution are you using? ec2-user is only valid for Amazon Linux. If you use another Linux distribution user is root or ubuntu (for Ubuntu Linux).

For any future searchers having this problem, I found one more issue. I downloaded the .pem key from AWS and converted to .ppk and tried to ssh using Putty, and I would get 'Server refused key'. After much hair pulling I randomly updated Putty to the latest available version (0.77 as of writing) and that solved my issue. Same issue with WinSCP.

Related

AWS Neo4j Connection Issue

I am using PuTTy to try to connect to AWS. I've followed the instructions at
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html?icmpid=docs_ec2_console
You are asked to get you instanceID, but then its use is not mentioned. Where does it go in the PuTTy setup?
My setup at present is:
AMI ID: neo4j-community-.....
Host name: ubuntu#ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com
port: 22
Authentication: link to my certificate, modified for PuTTY
Connection>Data>Autologin>Username: I've tried numerous items here
but none works.
The error I get is connection timeout. I'm using Windows 10 and have checked to ports for Putty in the Windows and McAfee firewalls ... Putty is enabled. I've check the ports at AWS and they are enabled.
I'm stumped and not sure where to go next.
The solution was adding/editing by SSH IP for my security group. This step was not included in the instructions mentioned above. When I did this, logon was successful.
See https://www.youtube.com/watch?v=0PtBREh74r4 for more on this setup

AWS EC2 closed my port 22

i have a problem, im trying to connect to my instance EC2 with SSH, but say: Connection closed by IP port 22
I was checking all the configuration, im using a Mac with iTerm (also try with terminal) and is not working, looks like AWS EC2 block my Key PEM.
I ask to AWS support, but they said my IP is not block and they dont see any problem...
What I try is open my port 22, enable the remote login, change the permission to my pem.
Also I configure my inbound connection, with the same configuration of another instance and is working.
I was searching for a solution, but I don't have a solution, maybe I can create another instance and move the content to another instance, but I don't know if I can do that?
any information will be helpful
Check that the username was incorrect. On ubuntu instances it should be "ubuntu" and on amazon instances it should be "ec2-user".
You need to check for the following steps in order to connect EC2 from Mac:
First download the pem file used / created at the time of instance creation.
We have a benefit using Linux / Mac over windows as PEM file created can directly be used to connect. For windows we need to convert it into PPK file.
Now change the permission of the file to Read / Write and make sure the file extension is .pem and not .txt
Check the EC2 permission weather the port is being enabled or not using the following sub steps:
Check the Routes Table for port 22 incoming request is allowed or not.
Check the Network Access Control List of the VPC at the subnet weather the incoming request at port 22 is allowed or not.
Check the Security Group of the instance that weather port 22 request is allowed or not.
By default all the incoming request is being Blocked by the AWS. And
we need to enable the port with the corresponding protocol to allow or
not.
If you have no idea then simply you can set the permission to ALL REQUEST to 0.0.0.0/0, this will enable to connect your EC2 to the internet and to your ssh as well.
Hope this helps.
After many days of struggling with this issue i found solution. You just have to stop your instances and de-attach your volumes and reattach them and it will work like charm. Hope it help you out.

Connecting to Amazon EC2 using Filezilla SFTP - Network error: Connection refused

I am completely new to Amazon EC2 and Filezilla. When I try to connect to the server, I am getting an error message: "Error: Network error: Connection refused"
The problem is that I can't get a complete tutorial on how to use Filezilla with Amazon EC2. I try to follow the steps in this post: Connect to Amazon EC2 file directory using Filezilla and SFTP, but it is still not working.
What I have done so far:
I add the following ports in the Security Group of my instance:
Turn off temporarily Windows firewall on my Remote machine (I am
using Windows Server 2016 Datacenter) and on my pc also.
Filezilla:
I imported my key file in Settings > Connection > SFTP, the file has
.pem as extension, I renamed it to .ppk before import but it is
still not working. I also try to convert it using PuttyGen but it
does not work.
Questions:
Are my ports correct in the inbound rules ?
Do I need to run Filezilla server (available in Xampp control panel)
on my remote machine ?
Additional Info:
When I try connecting to the server using FTP(insecure):
I get the following error message:
Try using username:
username = ec2-user

Connection getting refused to socket.io server on Amazon EC2

I have set up a a micro EC2 instance on AWS. Currently, I am using the free tier in Oregon. There are two problems which I am facing.
When I try to SSH the instance using the public DNS, it says host does not exist but when I try conencting it using the public IP, it connects to it. What setting is needed to use the public DNS ?
I have opened the SSH client using the IP address. I want to set up my application which needs Node.js and MongoDB. I installed Node.js using this
Next I installed MongoDB using this
Then I connected to my instance using Filezilla and uploaded my code to it. I then start my node application which uses socket.io.
When I try to connect to socket.io server using web browser, I get a message which says connection refused "error 111". I have opened TCP port 80 in instance's security groups. In iptables, I have forwarded port 80 to 8080, but still it does not work. I have also checked that the firewall is disabled in ec2. Kindly help me to resolve this issue.
Did you check if all of the necessary ports are open on Amazon Security Policy?
What you can do is to allow all traffic on Amazon Security Policy for test and see if the connection goes well or not.
You might also check if you need access DB from outside. In that case, you also have to open the mongodb port and setup mongodb correctly as well.
Other tools that might useful to test firewall and connection issue will be tcpdump and syslog file
For the dns issue, did you try to nslookup on that name and see if the IP shown matches your server IP?
As Amazon gives a long DNS hostname for the server, I always use my own domain name. It's much easier.
example : ec2.domainname.com, which points to the Amazon IP address
Hope that help.
My problem is resolved now..
For the DNS issue, earlier I needed proxy to access internet, so I guess the DNS name was not getting resolved. When I tried using proxy free internet, I was able to ssh using public DNS.
And regarding connection to socket.io, I used port 8080 instead of 80 and used "sudo node main.js" to run my node file. Now I am able to connect to the socket.io server and MongoDB.
Another thing which I want to ask is that would running the node file with sudo rights create some security issue ?
Thanks for the answer! That also worked for me. I had the same problem trying to connect through sockets (http://myipaddress:3000) to a node.js server, i tried opening ports on the actual ec2 instance and disabling the firewall through SSH but nothing worked. Had to go to Security Groups on the ec2 console and open a new inbound tcp rule enabling that port

Issues with connecting to ubuntu instance in amazon ec2

I am having some issues with connecting to ubuntu instance in amazon. I can connect to the default instance with default AMI installation. But when I select ubuntu, I cannot ssh into it.
It says operation timeout. I have tried instantiating other instances rebooting changing key pairs etc.
ssh -i mykey.pem ubuntu#ec2-54-203-164-37.us-west-2.compute.amazonaws.com
ssh: connect to host ec2-54-203-164-37.us-west-2.compute.amazonaws.com port 22: Operation timed out
The strange thing when I stop the instance, then only the ssh command connects and says the are you sure you want to verify the fingerprint thing.
I can easily log into the micro instance with the default AMI installation
I have added the ssh port in the security group as well
Have you tried connecting via Putty ,just use a ppk file and please check once
also you can add ICMP to your Security Group and check for ping resposnses
Regards
Devashish