diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index aa3fa04e1..e54ad3708 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -641,7 +641,11 @@ mw_ssh(){ # echo "info:$SSS" # SSS="127.0.0.1|22|root|xx" IFS='|' read -r SERVER_IP SERVER_PORT SERVER_USER SERVER_PASS <<< "$SSS" - sshpass -p "$SERVER_PASS" ssh -p "$SERVER_PORT" "$SERVER_IP" + echo "Attempting SSH connection to $SERVER_USER@$SERVER_IP:$SERVER_PORT" + if ! sshpass -p "$SERVER_PASS" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -p "$SERVER_PORT" "$SERVER_USER@$SERVER_IP" "echo 'SSH connection successful'"; then + echo "SSH connection failed to $SERVER_USER@$SERVER_IP:$SERVER_PORT" + return 1 + fi fi }