Using X11 Forwarding to Load Remote Graphical Applications

X11 forwarding lets a user start graphical applications installed on a remote Linux system so that they display within the desktop environment of the local system. The remote system doesn't need to have an X11 server or graphical desktop environment running, but the local system must have an X11 compatible service running.

Server-side Configuration

  1. Change the /etc/ssh/sshd_config file to enable X11 forwarding. On the server, verify the following parameters:

    X11Forwarding

    Allows X11 forwarding. When omitted, the default is no. To enable X11 forwarding, add an entry that sets the value for this parameter to yes.

  2. If you edit the configuration file, you must restart the service for the change to take effect:

    sudo systemctl restart sshd
  3. The remote system must also can run X11 applications and authenticate X11 sessions. The xorg-x11-xauth package is required for this purpose.

    dnf install xorg-x11-xauth
    If you have never run a graphical application on the remote server, the first time that you connect to the remote server using X11 forwarding, a warning message is displayed:
    /usr/bin/xauth: file /home/user/.Xauthority does not exist

    You can ignore this warning as the .Xauthority file is automatically created.

Client Configuration

  1. Use the -Y option with the SSH client when you connect to a remote server:

    ssh -Y user@server1.example.com
  2. Run a graphical application over the SSH connection by typing the command directly from the SSH terminal. For example, if gedit is installed on the remote system, you might run the following command:

    gedit &

    Tip:

    Use the & operator, as shown in the preceding example, to start process in the background so that the terminal remains available to you.