read vnc password and port from user home instead of env vars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 19:59:59 +00:00
co-authored by Claude Opus 4.6
parent 79668e436b
commit d5245e5418
4 changed files with 34 additions and 6 deletions
+5 -1
View File
@@ -5,7 +5,7 @@ set -euo pipefail
# Run as the user who will own the VNC session (not root).
# Usage: ./scripts/setup-desktop.sh <vnc-password> [resolution]
VNC_PASS="${1:-$(head -c 6 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | head -c 8)}"
VNC_PASS="${1:-$(head -c 32 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | head -c 8)}"
RESOLUTION="${2:-1920x1080}"
USER_NAME="$(whoami)"
ENV_FILE="$(cd "$(dirname "$0")/.." && pwd)/.env"
@@ -51,6 +51,10 @@ echo "[3/8] Configuring VNC password..."
mkdir -p ~/.vnc
echo "$VNC_PASS" | vncpasswd -f > ~/.vnc/passwd
chmod 600 ~/.vnc/passwd
# Plain-text password + port for the Officer server to read
echo -n "$VNC_PASS" > ~/.vnc/password
chmod 600 ~/.vnc/password
echo "5901" > ~/.vnc/port
echo " Done."
# --- Step 4: Create xstartup ---