Configure ssh key-based Authentication

Support for security such as Firewalls and securing linux
Post Reply
jvr968
Posts: 13
Joined: 2019/06/11 15:55:20

Configure ssh key-based Authentication

Post by jvr968 » 2019/08/02 17:08:02

Hello.
Im trying to add a new computer a ssh key-based authentication to my centos 7 server.
Im using this article as a guide.
https://www.digitalocean.com/community/ ... nux-server

I have generated the key pair. The private and public keys.
I uploaded the public key to the authorized_keys file in the server of the /root/.ssh
I checked if have that line in the /etc/ssh/sshd_config
PubkeyAuthentication yes
I have restarted the sshd service

But I'm still prompted for password when log in to the ssh server
I think im not missing anything.
Whats goign on?

-rw------- 1 root root 405 Aug 2 17:41 authorized_keys
-rw------- 1 root root 0 Aug 2 17:39 known_hosts

I guess the permissions of these server files are correct.

Thank you
Regards.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Configure ssh key-based Authentication

Post by aks » 2019/08/02 17:21:28

You're logging in as root? Bad - slap yourself. Also there's a PermitRoot (or something like that) in sshd_config.
Did you run a restorecon -R on ~/.ssh before attempting the connection?
Also you can use ssh -vvv to output verbose things about what's going on when connecting.
And you can look in the system logs (journalctl) for more clues.

Post Reply