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
  • 1
    Probably a stupid question, but did you put the key in the .ssh/authorized_keys file on the server side? And it is the id_rsa.pub you copied on the server, not the id_rsa, right?
    – MBR
    Sep 4, 2013 at 16:40
  • 2
    Please include the actual exact command you ran and their output. We can't know if you've done it correctly if you don't show what you did.
    – terdon
    Sep 4, 2013 at 16:55
  • 3
    Also show the output of ssh -vvv remotehost. Sep 4, 2013 at 17:38
  • Please share output from ls -l ~/.ssh, and ls -la | grep .ssh.
    – slm
    Sep 4, 2013 at 17:40
  • When I do regenerate the key on the client machine than it works. Is the hostname somehow encoded into the key or so?
    – jaksky
    Sep 5, 2013 at 8:29

3 Answers 3


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
  • Yea this helps when I do that manually. But I don't know why this doesn't work when I execute that command externally -as via some Config Management tool as puppet. For sure replacing user with correct value
    – jaksky
    Sep 5, 2013 at 11:42

These two lines from the ssh centos-howto solved the issue for me:

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys 

Can you try this. Add the following lines to ~/.ssh/config:

Host remotehost
 IdentityFile ~/.ssh/your_private_key

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.