0

I use a single private key to login to several Linux servers using PuTTY. When I need to login to a new machine, I first log in by password authentication and then add my public key to ~/.ssh/authorized_keys2 and use the private key thereafter.

But there's one machine to which I cannot login with my private key. I checked permissions for .ssh directory and authorized_keys2 file but they are the same as in machines where I can successfully log in.

What could be the problem here? Is it possible for an admin to disable private key based logins?

  • Please include PuTTY's even log into your question. And even better, the server's log file too. – Martin Prikryl Feb 13 '15 at 7:51
1

You should check sshd log to see, why it rejects your connection.

I find it unlikely that any admin would disable public key authentication.

Note that authorized_keys2 file is deprecated for very long time already. Use correct authorized_keys file instead. While the default OpenSSH configuration allows both files for a backward compatibility, it's possible that this particular installation allows for correct authorized_keys file only. Check AuthorizedKeysFile directive in sshd_config.

  • adding key to authorized_keys instead of authorized_keys2 solved the problem – Lahiru Chandima Feb 13 '15 at 10:20
1

OpenSSH supports a PubkeyAuthentication option in the configuration file. It affects SSH version 2 connections, and the option can be set to no. Also, the filenames can be configured. So that answers your last question.

To find out what is going on, your best bet is to check the server's logs. (This likely requires that you have superuser ("root") access.) The exact log name might vary on different systems: check /var/log/authlog

If that file doesn't exist, try ls -lt /var/log

The -t sorts by time, so you can find out what log gets updated when your attempt to log in is failing. (That can be quite helpful on a rather inactive server. That may be less useful if lots of logs are getting updated frequently.)

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.