SSH – SSH Passwordless Authentication Doesn’t Work

ssh

sorry for posting common topic again. I read several similar question but I still haven't found why it is not working. So let me describe what I did.
I generated private/public rsa key files on a different machine than client/server are.

Then I created ~/.ssh dir and copy over private key id_rsa on a client side, set appropriate owner and file permissions. On a server side I created again under the user I want connect to ~/.ssh put the public key into authorized keys.

When I tried ssh client to host it still requires password even though that keys were generated as password less.

Did I overlooked something obvious?

I also tried to find on a server side check the ssh log for details why it requires passwd – but /var/log/auth or /var/log/ssh doesn't exist. Isn't it enabled by default or do I need to change config of sshd and restart the service.

I'm using CentOS 6.

To Answer the questions:
~/.ssh on server side:

rw-------. hdfs hadoop  authorized_keys

rw-------. hdfs hadoop  config

rw-------. hdfs hadoop  id_rsa.pub

cnfig contains:

Host *
StrictHostKeyChecking no

~/.ssh on client side:

rw-------. hdfs hadoop authorized_keys

rw-------. hdfs hadoop config - the content is the same

rw-------. hdfs hadoop id_rsa

rw-r--r--. hdfs hadoop known_hosts 
  • this one were probably generated by my attempts

Best Answer

In CentOS 6, there is a bug that prevents ssh RSA authentication from working as desired if selinux is in Enforcing mode.

You can disable selinux, or you can try the workaround below:

restorecon -R -v ~$USER/.ssh
Related Question