1

I'm trying to connect from Windows 7 to a Linux Server using key based authentication. To do that, I've created the pair public/private keys using PuTTY keygen tool, and copied the content of the public key to the server's .ssh/authorized_keys file. When I'm using the ssh command line from my Windows OS and type: ssh user@server it asks for the password which shouldn't happen, because it has to read the private key from my .ssh folder:

click to see image

When I use PuTTY and I specify the private key I receive this message as well:

click to see image

My keys pair on my Windows OS is on the folder of my user account, under .ssh:

click to see image

And in the Linux server, the public key is inside the authorized_keys file in the ~/.ssh folder:

click to see image

And my public key is this:

click to see image

I don't know what's wrong with all this stuff.

0

Your editor is showing [noeol] while viewing your public key in the authorized_keys file - that might be a problem. Add the missing end-of-line character.

Is the authorized_keys file on the Linux server protected so that other users of the server can not modify it? If not, then sshd will just ignore it. More specifically, the authorized_keys file, the .ssh sub-directory and the user's home directory all need to be writable only by the user himself.

If these tips won't solve the problem, check the server's authentication log. In Linux, that'll usually be either /var/log/secure or /var/log/auth.log depending on distribution. The sshd daemon will log there an error message if it failed to read the authorized_key file or is ignoring it for some reason - and the error message will include the reason.

  • ssh -v (or even ssh -vv) will tell you more about what happens when you log in. – xenoid Jan 10 '18 at 11:46
  • But it won't tell you why sshd rejects a key. That information is in the server log only. – telcoM Jan 10 '18 at 12:40
  • Thank you @telcoM, I modified the permissions of the /home/eoecm01 folder. Now I have a message that says that my private keys are too open from my windows OS folder (0644), when I review my private key using Cygwin64 it has the 700 permissions. This is using the ssh utility program. When using putty it works fine. Thank you for your help – user2128078 Jan 10 '18 at 16:25

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.