what's the difference between /etc/init.d/sshd start and /usr/sbin/sshd?

4

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.

jasono

Posted 2012-10-29T22:48:25.120

Reputation: 41

1Just 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 – 2012-10-29T23:50:54.637

1"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 – 2012-10-30T00:11:05.720

What is "paswordless ssh"? Do you mean authentication keys? \ – Ярослав Рахматуллин – 2012-11-15T17:45:48.237

Answers

0

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.

Ярослав Рахматуллин

Posted 2012-10-29T22:48:25.120

Reputation: 9 076

0

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

Anurag Uniyal

Posted 2012-10-29T22:48:25.120

Reputation: 151