S50sshd 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. #
  3. # sshd Starts sshd.
  4. #
  5. # Make sure the ssh-keygen progam exists
  6. [ -f /usr/bin/ssh-keygen ] || exit 0
  7. # Check for the SSH1 RSA key
  8. if [ ! -f /etc/ssh_host_key ] ; then
  9. echo Generating RSA Key...
  10. /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh_host_key -C '' -N ''
  11. fi
  12. # Check for the SSH2 RSA key
  13. if [ ! -f /etc/ssh_host_rsa_key ] ; then
  14. echo Generating RSA Key...
  15. /usr/bin/ssh-keygen -t rsa -f /etc/ssh_host_rsa_key -C '' -N ''
  16. fi
  17. # Check for the SSH2 DSA key
  18. if [ ! -f /etc/ssh_host_dsa_key ] ; then
  19. echo Generating DSA Key...
  20. echo THIS CAN TAKE A MINUTE OR TWO DEPENDING ON YOUR PROCESSOR!
  21. echo
  22. /usr/bin/ssh-keygen -t dsa -f /etc/ssh_host_dsa_key -C '' -N ''
  23. fi
  24. umask 077
  25. start() {
  26. echo -n "Starting sshd: "
  27. /usr/sbin/sshd
  28. touch /var/lock/sshd
  29. echo "OK"
  30. }
  31. stop() {
  32. echo -n "Stopping sshd: "
  33. killall sshd
  34. rm -f /var/lock/sshd
  35. echo "OK"
  36. }
  37. restart() {
  38. stop
  39. start
  40. }
  41. case "$1" in
  42. start)
  43. start
  44. ;;
  45. stop)
  46. stop
  47. ;;
  48. restart|reload)
  49. restart
  50. ;;
  51. *)
  52. echo $"Usage: $0 {start|stop|restart}"
  53. exit 1
  54. esac
  55. exit $?