X11 Forwarding
Category: Intermediate
Difficulty: 2 out of 5
Duration: 15 minutes
1. Overview
2. Enable X11 Forwarding
3. Install X server
4. Use X11 Forwarding in SSH Client
5. Next Steps
Find a mistake? Let us know the issue here.

Enable X11 Forwarding
There are a few changes needed on the virtual machine to enable X11 forwarding. In this tutorial we use Ubuntu 18.04 or above. Other Linux distributions will have a very similar SSH daemon configuration. The SSH daemon configuration file is located at /etc/ssh/sshd_config
.
- Open the SSH daemon configuration file.
$ sudo vi /etc/ssh/sshd_config
- Locate and uncomment or change line
X11Forwarding
to beX11Forwarding yes
. This line allows the graphical application to be forwarded over to your computer.X11Forwarding yes
- Restart SSH daemon.
$ service sshd restart
- Install the graphical application
xclock
for testing. For Ubuntu or Debian,xclock
is included in thex11-apps
package, and can be installed as follows:$ apt -y install x11-apps
For RHEL, CentOS and Fedora, the package name is
xorg-x11-apps
and you should install it using eitheryum
ordnf
, depending on the distro.