Commit | Line | Data |
---|---|---|
fe2701c6 VM |
1 | #!/bin/sh |
2 | # | |
3 | # /etc/rc.d/sshd: start/stop ssh daemon | |
4 | # | |
5 | ||
6 | case $1 in | |
7 | start) | |
8 | if [ ! -f /etc/ssh/ssh_host_key ]; then | |
9 | /usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key > /dev/null | |
10 | fi | |
11 | if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then | |
12 | /usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key > /dev/null | |
13 | fi | |
14 | if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then | |
15 | /usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key > /dev/null | |
16 | fi | |
17 | if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then | |
18 | /usr/bin/ssh-keygen -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key > /dev/null | |
19 | fi | |
20 | /usr/sbin/sshd | |
21 | ;; | |
22 | stop) | |
23 | if [ -f /var/run/sshd.pid ]; then | |
24 | kill $(< /var/run/sshd.pid) | |
25 | rm -f /var/run/sshd.pid | |
26 | else | |
27 | killall -q /usr/sbin/sshd | |
28 | fi | |
29 | ;; | |
30 | restart) | |
31 | $0 stop | |
32 | sleep 2 | |
33 | $0 start | |
34 | ;; | |
35 | *) | |
36 | echo "usage: $0 [start|stop|restart]" | |
37 | ;; | |
38 | esac | |
39 | ||
40 | # End of file |