4
# /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" 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
. /lib/lsb/init-functions
15
check_for_no_start() {
16
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
17
if [ -e /etc/ssh/sshd_not_to_be_run ]; then
19
log_warning_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
25
# Create the PrivSep empty dir if necessary
26
if [ ! -d /var/run/sshd ]; then
28
chmod 0755 /var/run/sshd
33
if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then
34
/usr/sbin/sshd -t || exit 1
38
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
42
log_begin_msg "Starting OpenBSD Secure Shell server..."
45
start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS || log_end_msg 1
49
log_begin_msg "Stopping OpenBSD Secure Shell server..."
50
start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid || log_end_msg 1
55
log_begin_msg "Reloading OpenBSD Secure Shell server's configuration"
58
start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd || log_end_msg 1
63
log_begin_msg "Restarting OpenBSD Secure Shell server..."
65
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
68
start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS || log_end_msg 1
73
log_success_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"