blob: 48bba7cbc591d7c7dcf0918f93c07a4c81273fec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/bash
passwd=`genpasswd`
if (( $? != 0 )); then
reset
exit $?
fi
# change passwd file
sed -E -i -e 's/^root:[^:]*:/root:'"$passwd"':/' /etc/passwd
# generate host keys
mkdir -p /etc/dropbear
[[ -f /etc/dropbear/dropbear_dss_host_key ]] || dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key >/dev/null
[[ -f /etc/dropbear/dropbear_rsa_host_key ]] || dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key >/dev/null
echo ""
echo -n "Starting ssh daemon... "
dropbear -E 2>/var/log/dropbear.log && echo "OK"
|