summaryrefslogtreecommitdiffstats
path: root/rescue/startssh
blob: 4c585bc7fe9911a6caa7579399e8044a5d82096a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

passwd=`genpasswd`

if (( $? != 0 )); then
	reset
	exit $?
fi

sed -E -i -e 's/^root:[^:]*:/root:'"$passwd"':/' /etc/passwd

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 && echo "OK"