LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-30-2002, 03:53 PM   #1
Cephlen
LQ Newbie
 
Registered: Oct 2002
Posts: 6

Rep: Reputation: 0
Question SSHD start on boot problem...


Hello,

I am having a small problem getting sshd to startup on boot (it works if I run it manually).

sshd is not listed under my "services" section in the mandrake control center.

Doing a service sshd start gives me "Extra argument start" but it doesnt startup the sshd service.

Doing a chkconfig --add sshd gives me "service sshd does not support chkconfig"

In my init.d directory is a sshd file, but its a binary file - not a script. I dont know if this is normal or not.

There are no s??sshd ln's in my rc?.d directories.

I am running Mandrake 9.0 and compiled ssh version 3.5p1 using md5 and pam options. I tried using the included rpm with Mandrake9, but couldnt get it to work.

Thanks in advance..
 
Old 10-30-2002, 06:38 PM   #2
nonamenobody
Member
 
Registered: Oct 2002
Posts: 138

Rep: Reputation: 22
>> In my init.d directory is a sshd file, but its a binary file - not a script. I dont know if this is normal or not.


Normal? Not in any distro I've ever used, init should be just that scripts. This is particularly true if your system uses insserv, in order to change what runlevel a service runs at when, you use inserv, the comments at the top of the file need to be edited (obviously not possible). This seems very unusual to me, though I haven't used Mandrake in a while.

I have just checked the openssh rpm on a mandrake 9 cd, the file '/etc/rc.d/init.d/sshd' is an init script.
 
Old 10-30-2002, 07:16 PM   #3
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Suppose the installed sshd is under /usr/local/sbin/sshd, make a symlink in /etc/rc?.d to point to /usr/local/sbin/sshd
cd /etc/rc3.d
ln -sf /usr/local/sbin/sshd S##sshd
pick ## somewhere in mid 20's to 50's, I believe it's ok, repeat for any runlevel you are likely to boot
don't forget to create K links in rc0.d and rc6.d to shutdown sshd daemon gracefully

Last edited by neo77777; 10-30-2002 at 07:17 PM.
 
Old 10-30-2002, 07:41 PM   #4
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Sorry for a little confusion, above might not work because of "extra argument" error, create /etc/init.d/sshd script containing
Code:
!/bin/sh
# Start/stop/restart the secure shell server:

sshd_start() {
  # Create host keys if needed.
  if [ ! -r /etc/ssh/ssh_host_key ]; then
    /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N '' 
  fi
  if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
    /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
  fi
  if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
    /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
  fi
  /usr/sbin/sshd
}

sshd_stop() {
  killall sshd
}

sshd_restart() {
  if [ -r /var/run/sshd.pid ]; then
    echo "WARNING: killing listener process only.  To kill every sshd process, you must"
    echo "         use 'rc.sshd stop'.  'rc.sshd restart' kills only the parent sshd to"
    echo "         allow an admin logged in through sshd to use 'rc.sshd restart' without"
    echo "         being cut off.  If sshd has been upgraded, new connections will now"
    echo "         use the new version, which should be a safe enough approach."
    kill `cat /var/run/sshd.pid`
  else
    killall sshd
  fi
  sleep 1
  sshd_start
}

case "$1" in
'start')
  sshd_start
  ;;
'stop')
  sshd_stop
  ;;
'restart')
  sshd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
and make symlinks in /etc/rc?.d/ to point to /etc/init.d/sshd
ln -sf ../init.d/sshd S##sshd
and in runlevel 0 and 6
ln -sf ../init.d/sshd K##sshd
It should work, sorry for confusion, didn't think clearly
P.S. the script is taken from stock slackware ssh install, substitute the path to sshd daemon and you'll be alright

Last edited by neo77777; 10-30-2002 at 07:44 PM.
 
Old 10-31-2002, 03:50 PM   #5
Cephlen
LQ Newbie
 
Registered: Oct 2002
Posts: 6

Original Poster
Rep: Reputation: 0
neo77777, thank you very much!

I edited your script to my paths, created those ln's... and PRESTO!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding sshd as a subsystem to start at boot blur AIX 2 01-28-2005 04:57 PM
How do I automatically start sshd? jdruin Linux - Software 1 07-05-2004 09:07 PM
sshd start on boot mblanco2000 Linux - Security 5 05-18-2004 04:13 PM
getting sshd to start at boot eros Linux - Software 8 12-31-2003 01:06 PM
couldn't start SSHD jonnyb Linux - Networking 14 02-16-2003 03:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration