4 # /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon
6 test -x /usr/sbin/sshd || exit 0
7 ( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
9 if test -f /etc/default/ssh; then
13 check_for_no_start() {
14 # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
15 if [ -e /etc/ssh/sshd_not_to_be_run ]; then
16 echo "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
22 # Create the PrivSep empty dir if necessary
23 if [ ! -d /var/run/sshd ]; then
25 chmod 0755 /var/run/sshd
30 /usr/sbin/sshd -t || exit 1
34 # create keys if necessary
35 if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
36 echo " generating ssh RSA key..."
37 ssh-keygen -q -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
39 if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
40 echo " generating ssh DSA key..."
41 ssh-keygen -q -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
45 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
50 echo "Starting OpenBSD Secure Shell server: sshd"
53 start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS
57 echo -n "Stopping OpenBSD Secure Shell server: sshd"
58 start-stop-daemon -K -x /usr/sbin/sshd
66 echo -n "Reloading OpenBSD Secure Shell server's configuration"
67 start-stop-daemon -K -s 1 -x /usr/sbin/sshd
74 echo -n "Restarting OpenBSD Secure Shell server: sshd"
75 start-stop-daemon -K -x /usr/sbin/sshd
79 start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS
84 echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"