Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having issues with passwordless ssh. I've checked, double checked and checked again that I have everything set up correctly.

Both machines are RHEL6 and when the destination machine first boots up passwordless ssh does not work. If I stop ssh (service sshd stop or /ect/init.d/sshd stop) and then start it directly (/usr/sbin/sshd) passwordless ssh works fine.

If I start ssh via the service (service sshd start or /etc/init.d/sshd start) passwordless ssh does not work.

Just for testing I've tried commenting out the entire start() function in /etc/init.d/sshd and replace it with /usr/sbin/sshd - that still fails to allow passwordless ssh. I believe that this means that something in the /etc/init.d/sshd file is causing the screw up but I don't know enough about linux to narrow the issue down.

share|improve this question
Just to help me guess what is wrong, right after reboot, do /etc/init.d/sshd stop; /etc/init.d/sshd start and report back whether that (temporarily) fixed it. – BenjiWiebe Oct 29 '12 at 23:50
"Does not work" is really not a very good description of the problem. Does the sshd service run? Do you see the process in the process table? Do you get prompted for a password or do you get an error message? – David Schwartz Oct 30 '12 at 0:11
What is "paswordless ssh"? Do you mean authentication keys? \ – Ярослав Рахматуллин Nov 15 '12 at 17:45

It looks like the init.d version is starting with a different server key that is not recognized, but this should give you a warning om the client. It may be the case that the service is reading the configuration from some other place than you expect. It may also be the case that you have a xinetd service running that steals incoming connections to port 22.

try starting the service with mentioned methods and look for a difference in the output of

ps aux | grep [s]shd 

This may give you some clue about which config file is being used. Also, you may want to double check that sshd is listening on port 22 after you start it with /etc/init.d/sshd. This can be done with

netstat -ntpl 

Or by checking that "paswordfull" logins work.

share|improve this answer

There is a difference due to how they are executed, check this centos bug, to fix this delete first line "#!/bin/bash" from /etc/init.d/sshd

share|improve this answer

Your Answer


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.