0

After generating the private and public key for a RHEL Client and storing the public key in the authorized_keys folder of the RHEL 7 Server, I disabled the Root Login in the Server by going to /etc/ssh/sshd_config and setting PermitRootLogin to no. After that I restarted the sshd service.

Now when I am trying to do ssh from client to server it says

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

Why I am getting this message?

Raghav Gupta
  • 111
  • 3
  • Where did you put the authorized key on the server? What user are you logging in as? what command used? – shearn89 Jan 19 '22 at 11:06
  • @shearn89 I have put the public key of client under authorized_key file of server in directory - /root/.ssh . I am logging in as root user. What do you mean by what command used? You are asking for which command? – Raghav Gupta Jan 20 '22 at 12:04

1 Answers1

5

Your behavior is completely normal. Change your PermitRootLogin no to a more conform to your needs PermitRootLogin without-password

Be sure to have the right key at the right place (usually ~/.ssh/authorized_keys) with the good owner:group, and with the chmod 600 and 700 on ~/.ssh/authorized_keys and ~/.ssh.

  • Tried this. After this, now when I am doing ssh from client it is asking for password. Why's that? Password shouldn't be asked when doing ssh. – Raghav Gupta Jan 20 '22 at 12:02