-1

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

8
  • Please edit and don't use the answer for edits. Also, use the formatting tools.
    – Sven
    Jul 6, 2015 at 11:38
  • I bet you've more debug log than this. Could not load "/home/ashish/Keys/igepune.pem" as a RSA1 public key is the indication that your key is not a RSA1 public key. It just means its not using old protocol version of SSH. Please post the detailed debug output.
    – Samar
    Jul 6, 2015 at 23:39
  • I feel this is key to error "Incorrect RSA1 identifier " Jul 7, 2015 at 10:34
  • More Information which might be helpful : I have another dev server to which i am able to connect with same key ! Also i tried to ssh from another server but same error :( Jul 7, 2015 at 10:50
  • At last i did what i was avoiding ! I took Image of that aws-ec2 instance & gave it same Elastic Ip ! I was able to ssh to it ! Also i was able to ssh to original server after reboot ! Now I am able to ssh to both Original & image :) Thanks all for their help ! Aug 19, 2015 at 13:24

3 Answers 3

3

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

3
  • why can't ssh find the pem file it was able to find it before & pem file exits there still its giving error Sep 8, 2015 at 9:43
  • Is this issue from aws side ? Does it happens suddenly that sometimes you are not able to connect to your ec2 instance ie is there some i/o issues to ec2-instance & we are not able to login to that instance Oct 1, 2015 at 11:03
  • It happened to me again Oct 1, 2015 at 11:03
1

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.

5
  • I checked Ip ! still same error ! Haven't made any changes to ec2 instance nor rebooted it ! Jul 7, 2015 at 10:31
  • I don't see you adding the username in the script. Do you have 'ashish' as your username on the ec2 instance? Normally, the username is ubuntu for Ubuntu EC2. So your script should be like ssh ashish@ipxxxxx -v -i ~/Keys/igepune.pem Jul 8, 2015 at 11:34
  • Sorry it was an typo but I had already tried with user ubuntu@ipxxxx and also with existing username on that server ... Jul 9, 2015 at 6:35
  • 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 ?? Aug 19, 2015 at 6:00
  • pem keys don't have expiration date. You either delete them or they are good forever. Aug 20, 2015 at 11:50
0

I was able to ssh to server after reboot !

This happens because of this i/o problem ! It's amazon's ec2 issue so sometime there is i/o problem so keys on server are not found ! Simply rebooting solved the issue !

Thanks all for their help !

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .