I'm trying to set publicKey authentication on my RH7.4. Exact same procedure worked on 6.5... so I cannot figure out what is missing. Tried also step after step from documentation and sites, but all gives the same error Permission denied (publickey).

I generate RSA 2048 pairs. public key added to the server in authorized_keys. .ssh has priv 700 and authorized_keys 600.

copied the id_rsa to the server where I'm connecting from (/home/admin/.ssh/id_rsa)

in sshd_config, added those lines:

PasswordAuthentication no 
AuthenticationMethods publickey
PubkeyAuthentication yes

and reload the sshd service...

vvv debug of ssh:

Enter passphrase for key '/home/admin/.ssh/id_rsa': 
debug1: read PEM private key done: type RSA
debug3: sign_and_send_pubkey
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/admin/.ssh/id_dsa
debug3: no such identity: /home/admin/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

So it does identify that auth is publicKey and also can read the private key and sending a publickey packet... but nothing after that and failure coming. on the server where I try to connect to (RH7.4) there is no logging under /var/log/secure.

Any idea what's going on?

  • Do you see any errors in /var/log/messages ? – Atul Mar 28 '19 at 10:55
  • one row: 2019-03-28T20:45:09.258606+05:30 tier4-epnm3-lnx sshd[5589]: Connection closed by authenticating user admin port 43424 [preauth] – user2550112 Mar 28 '19 at 15:44
  • Is password auth allowed, and can you auth that way? Can you auth at a physical console? Try to separate if this is an SSH auth issue, or simply a system auth issue for the user 'admin'. – 0xSheepdog Mar 28 '19 at 22:38
  • console works fine... password auth is not allowed: PasswordAuthentication no – user2550112 Mar 29 '19 at 8:01

Your Answer

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

Browse other questions tagged or ask your own question.