summaryrefslogtreecommitdiffstats
path: root/rescue/startssh
diff options
context:
space:
mode:
authorMaarten Vanraes <alien@mageia.org>2012-02-26 17:10:20 +0000
committerMaarten Vanraes <alien@mageia.org>2012-02-26 17:10:20 +0000
commitce67660b88bc18e2dcb03a5a222faa55b1cdc268 (patch)
treebf5bc6c3820e580d89b5fcee0c8cdc304a41be49 /rescue/startssh
parentb77e64fdb0329ca8cb9e8b3d8125d33faa3537e5 (diff)
downloaddrakx-ce67660b88bc18e2dcb03a5a222faa55b1cdc268.tar
drakx-ce67660b88bc18e2dcb03a5a222faa55b1cdc268.tar.gz
drakx-ce67660b88bc18e2dcb03a5a222faa55b1cdc268.tar.bz2
drakx-ce67660b88bc18e2dcb03a5a222faa55b1cdc268.tar.xz
drakx-ce67660b88bc18e2dcb03a5a222faa55b1cdc268.zip
escape / in generated passwords & add trailing ; in command lists in startssh
Diffstat (limited to 'rescue/startssh')
-rwxr-xr-xrescue/startssh8
1 files changed, 4 insertions, 4 deletions
diff --git a/rescue/startssh b/rescue/startssh
index 0a88820de..e14bb10e8 100755
--- a/rescue/startssh
+++ b/rescue/startssh
@@ -8,8 +8,8 @@ fi
# 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 || { echo "Can't generate dsa host key" >&2 ; exit 4 }
-[[ -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_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_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; }
# set a password
passwd=`genpasswd`
@@ -17,11 +17,11 @@ if (( $? != 0 )); then
reset
exit $?
fi
-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; }
# test for /dev/pts
grep '^devpts /dev/pts devpts ' /proc/mounts >/dev/null 2>/dev/null || mount -t devpts devpts /dev/pts
echo ""
echo -n "Starting ssh daemon... "
-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; }