X11 Forwarding for Remote Applications

Guide to Open Firefox or Other Graphical Applications Remotely over SSH

Open Remote GUI Applications with X11 Forwarding

Steps to run Firefox, xclock, or another graphical application from a remote Linux host through SSH.

  • 1

    Install and Start a Local X Server

    Your local machine needs an X server before remote graphical applications can open on your screen.

    On macOS, install XQuartz and restart your session:

    brew install --cask xquartz

    On Windows, install and start VcXsrv or Xming. On Linux desktops, the X server is usually already available.

  • 2

    Enable X11 Forwarding on SSH

    On the remote Linux host, edit the SSH daemon configuration file:

    sudo nano /etc/ssh/sshd_config

    Add or modify the following lines:

    X11Forwarding yes
    X11DisplayOffset 10
    X11UseLocalhost yes
    			

    Restart the SSH service to apply changes. The service name depends on the distribution:

    sudo systemctl restart ssh
    
    sudo systemctl restart sshd
    			
  • 3

    Install Only the Remote Applications You Need

    On the remote Linux host, install only the graphical application you want to open.

    Optional test tool for xclock:

    sudo apt update
    sudo apt install x11-apps
    			

    Optional browser package if Firefox is not already installed:

    sudo apt install firefox-esr
    			
  • 4

    Connect with X11 Forwarding

    From your local machine, connect to the remote host with trusted X11 forwarding:

    ssh -Y user@remote-host

    If -Y is not allowed in your environment, try standard X11 forwarding:

    ssh -X user@remote-host
  • 5

    Test X11 Forwarding

    After logging in through SSH, run the following commands on the remote host:

    echo $DISPLAY
    
    xclock
    			

    If the clock is not displayed, X11 forwarding is not configured correctly.

  • 6

    Open Firefox or Another Remote Application

    Once the X11 test works, start the remote graphical application from the SSH session:

    firefox &
    
    firefox-esr &
    			

    The application runs on the remote host, but its window should appear on your local desktop.