Update mw.tpl

This commit is contained in:
dami
2026-02-01 03:45:08 +08:00
parent ef7da60ec0
commit c4bffbda11
+5 -1
View File
@@ -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
}