#!/bin/sh # # sshd sshd (secure shell daemon) # # chkconfig: 345 55 45 # # description: sshd (secure shell daemon) is a server part of the ssh suite. # Ssh can be used for remote login, remote file copying, TCP port # forwarding etc. Ssh offers strong encryption and authentication. # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd # Check that networking is up. if is_no "${NETWORKING}"; then msg_Network_Down OpenSSH exit 1 fi # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/sshd ]; then msg_starting OpenSSH daemon sshd -h /etc/ssh/ssh_host_key RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd else msg_Already_Running OpenSSH fi ;; stop) if [ -f /var/lock/subsys/sshd ]; then msg_stopping OpenSSH killproc sshd rm -f /var/run/sshd.pid /var/lock/subsys/sshd >/dev/null 2>&1 else msg_Not_Running OpenSSH exit 1 fi ;; restart) $0 stop $0 start ;; status) status sshd exit $? ;; *) msg_Usage "$0 {start|stop|status|restart}" exit 1 esac exit $RETVAL