X11 Forwarding







880263b0-baa1-4b88-a5b3-6bc5be61feeb.png

X11 forwarding is an extremely useful tool that allows for the displaying of graphical applications running on remote Linux systems onto local PCs. This offers versatility and convenience for different applications.

X11 Forwarding Functionality

X11 forwarding works by running an X server locally on the PC that renders the GUI from the remote Linux system after establishing an SSH connection between the two.

Linux systems have the X server preinstalled. For Windows systems, it is necessary to install Xming or VcXsrv to run as the servers. Xming is functional for small graphical applications such as X11 apps, while VcXsrv is more suitable for heavier tasks such as RQT and RViz. The X server for MacOS systems is called XQuartz.

Basic X11 Forwarding Demo on Windows System

Follow the steps below to show X11 Forwarding in action:

On PC

  • Download VcXsrv installer and install the server on your PC.

  • Search for XLaunch and open it. It should bring up the following window:

Screenshot 2025-06-26 124304.png

 


  • Ensure the following options are chosen as you go select 'next':

    • Multiple Windows

    • Start no client

    • Clipboard

    • Primary selection

    • Native opengl

    • Disable access control

Then select ‘Finish’.

On Local Linux System

  • Access the local Linux system on your PC by running ssh linux@linux.local replacing 'linux' with the username of the system.

  • Open a file called sshd_config by running sudo nano /etc/ssh/sshd_config.

  • Scroll to the of the code in the file with the text #X11 Forwarding no or similar. Uncomment the line by deleting the '#' and change it to X11 Forwarding yes. Save and exit.

  • Run the command export DISPLAY=PI_IP_Address:0, replacing PI_IP_Address with your PC's IP address. You could get your PC's IP address by running ipconfig on a Windows CMD terminal. The IP address is usually under IP4V at Wireless LAN adapter Wi-Fi.

Screenshot 2025-06-24 113852.png

The set up should now be ready to run. Confirm this by running rviz2 on the remote Linux system’s terminal. RViz should open on the PC.

X11 Apps

Some fun and useful graphical applications may be installed on the remote Linux machine called X apps.

They are installed using the command sudo apt install x11-apps.

The apps include xeyes, xclock, xterm etc.

xeyes for example follows the position of the cursor on the screen. It is started by simply running the command xeyes.



image-20250626-113532.png

References

Comments

Popular posts from this blog

ROBOT MOBILE PLATFORM

Getting Started with ROS2 Humble: Workspace, Packages, and Nodes