summaryrefslogtreecommitdiffstats
path: root/openssh/sshd
blob: d6d24ede58f3b2236ed6b0e420a0c01ffbca1317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
#
# /etc/rc.d/sshd: start/stop ssh daemon
#

case $1 in
start)
	if [ ! -f /etc/ssh/ssh_host_key ]; then
		/usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key > /dev/null
	fi
	if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
		/usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key > /dev/null
	fi
	if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
		/usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key > /dev/null
	fi
	/usr/sbin/sshd
	;;
stop)
	if [ -f /var/run/sshd.pid ]; then
		kill $(< /var/run/sshd.pid)
		rm -f /var/run/sshd.pid
	else
		killall -q /usr/sbin/sshd
	fi
	;;
restart)
	$0 stop
	sleep 2
	$0 start
	;;
*)
	echo "usage: $0 [start|stop|restart]"
	;;
esac

# End of file