Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RedHat 6/Oracle Linux 6 is not allowing key authentication via ssh

Keys are properly deployed in ~/.ssh/authorized_keys

Yet ssh keeps on prompting for a password.

like image 913
Olivier Refalo Avatar asked Mar 16 '12 17:03

Olivier Refalo


People also ask

Why is my SSH key not working?

Make sure the authorized_keys file and the private key itself have the correct permissions and ownership. Check that key-based authentication is allowed by the server. Make sure the private key is readable by the SSH client. If you're using PuTTY, make sure your SSH keys are properly configured for the session.


1 Answers

Several issues, mostly privileges - but also related to SELinux on RedHat 6

The following script should fix them all, please replace <user>:<group> with your matching userid and group

chown -R <user>:<group> ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
restorecon -R -v ~/.ssh
like image 74
Olivier Refalo Avatar answered Sep 25 '22 20:09

Olivier Refalo