Skip to content

Instantly share code, notes, and snippets.

@0xBigBoss
Created January 16, 2026 18:12
Show Gist options
  • Select an option

  • Save 0xBigBoss/e1796842e766b3429610d379a3548bf2 to your computer and use it in GitHub Desktop.

Select an option

Save 0xBigBoss/e1796842e766b3429610d379a3548bf2 to your computer and use it in GitHub Desktop.
Reset XFCE session for xRDP - kills stale sessions and restarts services
#!/bin/bash
# Reset XFCE session for xRDP
# Kills stale sessions and restarts xrdp services
set -e
echo "Killing xfce4-session..."
pkill -u "$(whoami)" -f "xfce4-session" 2>/dev/null || true
echo "Killing orphaned Xorg..."
pkill -u "$(whoami)" -f "Xorg.*:" 2>/dev/null || true
sleep 1
echo "Removing X lock files..."
rm -f /tmp/.X*-lock 2>/dev/null || true
echo "Restarting xrdp services..."
sudo systemctl restart xrdp-sesman xrdp
sleep 2
echo "Done. Reconnect now."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment