Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
share|improve this question
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 '13 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 '13 at 16:55
3  
Also show the output of ssh -vvv remotehost. –  Warren Young Sep 4 '13 at 17:38
    
Please share output from ls -l ~/.ssh, and ls -la | grep .ssh. –  slm Sep 4 '13 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 '13 at 8:29

2 Answers 2

up vote 2 down vote accepted

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
share|improve this answer
    
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 '13 at 11:42
    
Sorted. Thanks for helping me out –  jaksky Sep 5 '13 at 12:14

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

Host remotehost
 IdentityFile ~/.ssh/your_private_key
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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