summaryrefslogtreecommitdiffstats
path: root/rescue/startssh
blob: 4c48d82912b0de5175f59237ea7b51d665d60275 (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
[[ -f /etc/dropbear/dropbear_rsa_host_key ]] || dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key

echo ""
echo -n "Starting ssh daemon... "
dropbear && echo "OK"