0

When trying to connect to a server with:

ssh -i MYKEY_SSH user@IP

It prompts for the password. However, if I rename that key for any other name the connection is properly established.

That is, if I do:

cp MYKEY_SSH whatever_ssh

then

ssh -i whatever_ssh user@IP

Is able to connect directly.

I can't figure out where is the problem.

No particular ssh config in my local system and no change in the permissions when renaming.

In a unsuccesful SSH key connection the debug says:

debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: vm@localhost.localdomain
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: key_ssh
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password

And in a succesful one I see that after that it says:

debug1: Trying private key: key_ssh
debug1: Authentication succeeded (publickey).
Authenticated to IP ([IP]:22).
  • Try running ssh with the "-vv" flag to print debugging info. Do it both for the key that works and the key that doesn't. Then edit your question to include the info. – Kenster Dec 14 '19 at 17:21
1

As described here I have an id_rsa.pub file which does not match the main key file, so that was the cause of the problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.