This commit is contained in:
Cuishibing
2026-04-19 00:09:59 +08:00
parent 2d6a6ac22b
commit 3f3e1c4878
3 changed files with 73 additions and 10 deletions

View File

@@ -1,10 +1,11 @@
#!/bin/bash
REMOTE_HOST="47.120.74.73"
REMOTE_HOST="smalltown.dubaoda.com"
REMOTE_PORT="30000"
LOCAL_PORT="3000"
SSH_PORT="22"
SSH_PASSWORD="MyPassword2+"
SSH_PORT="9527"
SSH_USER="cui"
SSH_PASSWORD="mima643237029"
PID_FILE="/tmp/ssh_tunnel.pid"
LOG_FILE="/tmp/ssh_tunnel.log"
@@ -19,7 +20,7 @@ start_tunnel() {
fi
echo "正在启动SSH反向隧道..."
sshpass -p "$SSH_PASSWORD" ssh -N -g -R "0.0.0.0:$REMOTE_PORT":localhost:"$LOCAL_PORT" -p "$SSH_PORT" -o "ServerAliveInterval=60" -o "ServerAliveCountMax=3" root@"$REMOTE_HOST" > "$LOG_FILE" 2>&1 &
sshpass -p "$SSH_PASSWORD" ssh -N -g -R "0.0.0.0:$REMOTE_PORT":localhost:"$LOCAL_PORT" -p "$SSH_PORT" -o "ServerAliveInterval=60" -o "ServerAliveCountMax=3" "$SSH_USER"@"$REMOTE_HOST" > "$LOG_FILE" 2>&1 &
SSH_PID=$!
echo "$SSH_PID" > "$PID_FILE"
sleep 2