Operating System - HP-UX
1833322 Members
3469 Online
110051 Solutions
New Discussion

SSHD not starting at boot

 
Nickolas A Gray
Advisor

SSHD not starting at boot

I compiled and installed OpenSSH and it has been running fine for a couple of months. The problem is that when the box is rebooted SSHD does not start automatically. I used the required /sbin/init.d/template script as a starting point which I renamed sshd after modifying it to run /usr/local/sbin/sshd, I created a /etc/rc.config.d/sshd file with the value of SSHD=1, I created links to the /sbin/init.d/sshd as /sbin/rc3.d/S900sshd and /sbin/rc2.d/K100sshd. If I init the system from level 2 to level 3 and back the process starts and stops. On reboot I even get the checklist message that the "sshd subsystem has started". When I try to ssh in it doesnt work. After telneting in ps -ef| grep for ssh with no luck. I also grep out the /var/admin/syslog/syslog.log for ssh with no luck. If I start the process after logging in I see this in the syslog.log
Apr 5 10:59:51 nofear sshd[1783]: Server listening on 0.0.0.0 port 22.
Apr 5 10:59:51 nofear sshd[1783]: Generating 768 bit RSA key.
Apr 5 10:59:55 nofear sshd[1783]: RSA key generation complete.

Any help would be appreciated. Thanks
6 REPLIES 6
Kofi ARTHIABAH
Honored Contributor

Re: SSHD not starting at boot

Hi Nikolas:

Could you please attach your /sbin/init.d/sshd script. One thing that comes to mind as a potential problem is your PATH definitions in the script.

Also look in your /etc/rc.log to see what it says about starting sshd you could also run:

sh -x /sbin/init.d/sshd start

and see what shows up.

nothing wrong with me that a few lines of code cannot fix!
Nickolas A Gray
Advisor

Re: SSHD not starting at boot

Thanks, I have attached the script. I will copy my PATH at login to my PATH statement, reboot and see what that does.
Ahmed Masud
New Member

Re: SSHD not starting at boot

The putting of sshd in the background with:

/usr/local/sbin/sshd &
^^^

may be the problem. sshd puts itself in daemon mode (i.e. launches a child after configuring itself) so you shouldn't have to do this. Also why attempt to stop it in init 2? It should simply be started in init 2 and stopped in init 0. No? :)

That was my 2cents worth.

cheers,

Ahmed
Shannon Petry
Honored Contributor

Re: SSHD not starting at boot

I agree that backgrounding it may be killing it. Is this your script?
I would change the last kill statement from cutting 10-14 to be
awk '{print $2}'. Even though your taking 5 chars, I'd be worried about the 6th digit. I have a server now at 87xxx for the process numbers.....I know it's 10.20 and not 11 which allocates PIDS a bit differently....

Try just removing the ampersand from sshd's launch and see if it is Okay at boot then!

Regards,
Shannon
Microsoft. When do you want a virus today?
Shannon Petry
Honored Contributor

Re: SSHD not starting at boot

I agree that backgrounding it may be killing it. Is this your script?
I would change the last kill statement from cutting 10-14 to be
awk '{print $2}'. Even though your taking 5 chars, I'd be worried about the 6th digit. I have a server now at 87xxx for the process numbers.....I know it's 10.20 and not 11 which allocates PIDS a bit differently....

Try just removing the ampersand from sshd's launch and see if it is Okay at boot then!

Regards,
Shannon
Microsoft. When do you want a virus today?
Nickolas A Gray
Advisor

Re: SSHD not starting at boot

Thanks to all who answered. In answer to the question about the script. This is the HP supplied /sbin/init.d/template that is "supposed" to be used as a start for these things. After tinkering with it I decided to use the "Solaris method" I just created a script with /usr/local/sbin/sshd in it and link it back to the rc3.d directory script. I will take all of your suggestions and continue to hack at it on my test box. For now this lets my prod boxes come up on boot.