#!/bin/sh SSH_ROOT=/usr/local/openssh SSH_BIN=$SSH_ROOT/bin SSH_ETC=$SSH_ROOT/etc SSH_SBIN=$SSH_ROOT/sbin case "$1" in 'start') if [ ! -d $SSH_ETC ]; then echo -n "sshd: Cannot access directory " echo -n "$SSH_ETC" echo ". Skipping ssh startup." exit 0 fi if [ ! -d $SSH_BIN ]; then echo -n "sshd: Cannot access directory " echo -n "$SSH_BIN" echo ". Skipping ssh startup." exit 0 fi if [ ! -d $SSH_SBIN ]; then echo -n "sshd: Cannot access directory " echo -n "$SSH_SBIN" echo ". Skipping ssh startup." exit 0 fi if [ ! -f $SSH_ETC/ssh_host_key ]; then echo ' creating ssh RSA host key'; $SSH_BIN/ssh-keygen -N "" -f $SSH_ETC/ssh_host_key fi if [ ! -f $SSH_ETC/ssh_host_dsa_key ]; then echo ' creating ssh DSA host key'; $SSH_BIN/ssh-keygen -d -N "" -f $SSH_ETC/ssh_host_dsa_key fi echo -n "sshd: Starting the ssh daemon..." $SSH_SBIN/sshd echo "done." exit 1 ;; 'stop') echo -n "sshd: Stopping the ssh daemon..." killall sshd echo "done." ;; *) echo "usage: $0 {start|stop}" ;; esac