Files
RDtop/scripts/host/manual-start-rustdesk.sh

44 lines
1.1 KiB
Bash

#!/bin/bash
# RustDesk Client Launcher for VPS (Manual Run)
# Run this script when you want to connect to host from VPS
# 1. Ensure no conflicting X servers
pkill -f Xvfb
pkill -f Xorg
# 2. Start Xvfb on :0
rm -f /tmp/.X11-unix/X0 /tmp/.X0-lock 2>/dev/null
/usr/bin/Xvfb :0 -screen 0 1920x1080x24 +extension GLX +extension RANDR +extension RENDER -ac &
echo "Xvfb started on :0"
sleep 2
# 3. Configure RustDesk
cat > ~/.config/rustdesk/RustDesk2.toml <<'EOF'
rendezvous_server = 'localhost:21116'
custom-rendezvous-server = 'localhost:21116'
key = 'JDSXd9sxN6Y7mIzu3krSpPTTc4yjChfqpzgIH5fl9Iw='
nat_type = 1
serial = 0
unlock_pin = ''
[options]
local-ip-addr = '2.59.219.61'
EOF
# 4. Start RustDesk client
export DISPLAY=:0
export XAUTHORITY=/root/.Xauthority
export LIBVA_DRIVER_NAME=none
export VDPAU_DRIVER=none
# Add xauth for display :0
xauth -f "$XAUTHORITY" add :0 . $(mcookie) 2>/dev/null || true
echo "Starting RustDesk..."
nohup /usr/share/rustdesk/rustdesk &
echo "RustDesk started. Check ID: DISPLAY=:0 /usr/share/rustdesk/rustdesk --get-id"
sleep 2
echo "Current ID:"
DISPLAY=:0 /usr/share/rustdesk/rustdesk --get-id