3 # Starts dropbear sshd.
6 # Allow a few customizations from a config file
7 test -r /etc
/default
/dropbear
&& .
/etc
/default
/dropbear
10 DROPBEAR_ARGS
="$DROPBEAR_ARGS -R"
12 # If /etc/dropbear is a symlink to /var/run/dropbear, and
13 # - the filesystem is RO (i.e. we can not rm the symlink),
14 # create the directory pointed to by the symlink.
15 # - the filesystem is RW (i.e. we can rm the symlink),
16 # replace the symlink with an actual directory
17 if [ -L /etc
/dropbear \
18 -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]
20 if rm -f /etc
/dropbear
>/dev
/null
2>&1; then
21 mkdir
-p /etc
/dropbear
23 echo "No persistent location to store SSH host keys. New keys will be"
24 echo "generated at each boot. Are you sure this is what you want to do?"
25 mkdir
-p "$(readlink /etc/dropbear)"
29 printf "Starting dropbear sshd: "
32 start-stop-daemon
-S -q -p /var
/run
/dropbear.pid \
33 --exec /usr
/sbin
/dropbear
-- $DROPBEAR_ARGS
34 [ $?
= 0 ] && echo "OK" ||
echo "FAIL"
37 printf "Stopping dropbear sshd: "
38 start-stop-daemon
-K -q -p /var
/run
/dropbear.pid
39 [ $?
= 0 ] && echo "OK" ||
echo "FAIL"
57 echo "Usage: $0 {start|stop|restart}"