Skip to content

Instantly share code, notes, and snippets.

@refabr1k
Created October 25, 2023 23:34
Show Gist options
  • Save refabr1k/1de8b015fa53fe4700a58e06fb201dcc to your computer and use it in GitHub Desktop.
Save refabr1k/1de8b015fa53fe4700a58e06fb201dcc to your computer and use it in GitHub Desktop.
setup xrdp server

On the Linux Server:

  1. Install xrdp and xfce (or another desktop environment)

    sudo apt update
    sudo apt install xrdp xfce4 xfce4-goodies
  2. Configure xrdp to use xfce

    echo xfce4-session >~/.xsession
  3. Backup the current startwm.sh:

    Before making changes, it's a good idea to back up the original file.

    sudo cp /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.backup
  4. Edit startwm.sh:

    sudo nano /etc/xrdp/startwm.sh
  5. Allow xrdp through firewall (if you have UFW enabled)

    sudo ufw allow 3389/tcp
  6. Modify the file:

    At the end of the file, before the two exec lines, add startxfce4. Then comment out the two exec lines using the # character. Your file should look like:

    if test -r /etc/profile; then
            . /etc/profile
    fi
    
    if test -r ~/.profile; then
            . ~/.profile
    fi
    
    #test -x /etc/X11/Xsession && exec /etc/X11/Xsession
    #exec /bin/sh /etc/X11/Xsession
    
    dbus-launch --exit-with-session startxfce4
  7. Session Cleanup:

    rm ~/.ICEauthority
    rm ~/.Xauthority
    
  8. Restart xrdp:

  9. Start and enable xrdp service

    # autostart
    sudo systemctl enable xrdp
    
    sudo systemctl start xrdp
    # or restart if it is already enabled
    sudo systemctl restart xrdp

On the Windows Client:

  1. Open Remote Desktop Connection > select "Xorg" session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment