Skip to main content

Connection established. Still ssh login issue to Ubuntu ec2 instance [Resolved]

I am not able to login to my Server (ec2 instance). Before this I was able to login. No changes has been made to server or Security groups ! Is this issue from aws side ? Does it happens suddenly that sometimes you are not able to connect to your ec2 instance and need reboot or is it a security flaw due to which someone may be tampering my keys on server ?

ashish@ashishk:~/MyScripts$ ./test.ssh 

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to test.ige.com [ipxxxxx] port 22.
debug1: Connection established.
debug1: identity file /home/ashish/Keys/igepune.pem type -1
debug1: identity file /home/ashish/Keys/igepune.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2

My login script :

ashish@ashishk:~/MyScripts$ cat ./test.ssh 
ssh ubunt@ipxxxxx -v -i ~/Keys/igepune.pem 

Out Put with -vvv :

ashish@ashishk:~/MyScripts$ ./test.ssh 

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to test.ige.com [ipxxxx] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/ashish/Keys/igepune.pem" as a RSA1 public key
debug1: identity file /home/ashish/Keys/igepune.pem type -1
debug1: identity file /home/ashish/Keys/igepune.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2

**ashish@ashishk:~/MyScripts$ ll /home/ashish/Keys/igepune.pem**

-r-------- 1 ashish ashish 1679 Apr 21 18:56 /home/ashish/Keys/igepune.pem

I have a doubt do Amazon expires pem keys after certain period of time ??


Question Credit: Ashish Karpe
Question Reference
Asked July 20, 2019
Posted Under: Network
10 views
3 Answers

From your debug output:

debug1: identity file /home/ashish/Keys/igepune.pem type -1
debug1: identity file /home/ashish/Keys/igepune.pem-cert type -1

The "-1" at the end of the "identity file" lines means your SSH client couldn't find a file to use.

Also, instead of -v parameter for ssh, you can make it more verbose with -vvvv


credit: Andrii Kupchanko
Answered July 20, 2019

Actually, you may want to double check the ip address of the server to connect to. If you reboot the AWS EC2 instance with elastic ip, the public ip address changes and hence you may not be able to login.

Another thing to look at is if your ip address has changed. If you have set security rules to restrict access to your ip address, then you would not be able to login if your ip address would have changed.


credit: Ketan Patel
Answered July 20, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA