8 |
|
|
9 |
# generate host keys |
# generate host keys |
10 |
mkdir -p /etc/dropbear |
mkdir -p /etc/dropbear |
11 |
[[ -f /etc/dropbear/dropbear_dss_host_key ]] || dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key >/dev/null || { echo "Can't generate dsa host key" >&2 ; exit 4 } |
[[ -f /etc/dropbear/dropbear_dss_host_key ]] || dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key >/dev/null || { echo "Can't generate dsa host key" >&2 ; exit 4; } |
12 |
[[ -f /etc/dropbear/dropbear_rsa_host_key ]] || dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key >/dev/null || { echo "Can't generate rsa host key" >&2 ; exit 3 } |
[[ -f /etc/dropbear/dropbear_rsa_host_key ]] || dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key >/dev/null || { echo "Can't generate rsa host key" >&2 ; exit 3; } |
13 |
|
|
14 |
# set a password |
# set a password |
15 |
passwd=`genpasswd` |
passwd=`genpasswd` |
17 |
reset |
reset |
18 |
exit $? |
exit $? |
19 |
fi |
fi |
20 |
sed -E -i -e 's/^root:[^:]*:/root:'"$passwd"':/' /etc/passwd || { echo "Can't set password" >&2 ; exit 2 } |
sed -E -i -e 's/^root:[^:]*:/root:'"${passwd//\//\\/}"':/' /etc/passwd || { echo "Can't set password" >&2 ; exit 2; } |
21 |
|
|
22 |
# test for /dev/pts |
# test for /dev/pts |
23 |
grep '^devpts /dev/pts devpts ' /proc/mounts >/dev/null 2>/dev/null || mount -t devpts devpts /dev/pts |
grep '^devpts /dev/pts devpts ' /proc/mounts >/dev/null 2>/dev/null || mount -t devpts devpts /dev/pts |
24 |
|
|
25 |
echo "" |
echo "" |
26 |
echo -n "Starting ssh daemon... " |
echo -n "Starting ssh daemon... " |
27 |
dropbear -E 2>/var/log/dropbear.log && echo "OK" || { echo "Failed" ; exit 1 } |
dropbear -E 2>/var/log/dropbear.log && echo "OK" || { echo "Failed" ; exit 1; } |