I saw it was possible to use a SSH key (with passphrase) and a password for authentication on: https://security.stackexchange.com/questions/17931/possible-to-use-both-private-key-and-password-authentication-for-ssh-login I have a CentOS 7 remote VPS and a Windows local machine.

I made a public and private key (SSH-2 RSA, 2048 bits with passphrase) with PuTTYgen on my Windows machine.

On CentOS I added the pasteable public key to ~/.ssh/authorized_keys, when I was a root user. I also changed the permissions of the folder, with: sudo chmod g-w ~/ && sudo chmod 755 ~/.ssh && sudo chmod 600 ~/.ssh/authorized_keys

Then I changed /etc/ssh/sshd_config to:

Protocol 2

PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication yes

AuthorizedKeysFile %h/.ssh/authorized_keys
AuthenticationMethods "publickey,password"

And I restarted the SSH server with sudo systemctl restart sshd.service. I didn't close Putty on this Windows local machine.

I wanted to check on a other Windows machine if it worked. I added the private ppk file to Pageant, and also pointed it to that file in Putty. But then when I try to open the connection Putty gives this error message:

"disconnected no supported authentication methods available server sent publickey".

What can be the problem, how can I auth with a SSH key (with passphrase) and a root password?

migrated from security.stackexchange.com Aug 27 '16 at 22:06

This question came from our site for information security professionals.

  • 1
    Please check the syslog/systemd files. This usually has to do with permissions. – Yorick de Wid Aug 25 '16 at 14:15
  • In /var/log/secure I also see key_read: key_from_blob \n failed, I used the pasteable public key but I placed a enter after ssh-rsa and after the hash. That's not allowed? – Jeroen Steen Aug 25 '16 at 14:57
  • 1
    The entire string must me on one line, yes – Yorick de Wid Aug 25 '16 at 14:59

You might want to try chmod 700 on the .ssh/ directory as the SSH config should only be accessible by the user itself. Also, is the user the owner of the .ssh/ directory and files? (chown -R <user>: .ssh/).

Kudo's for leaving the current session open, people often forget this and lock themselves out.

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.