Fixing the 'Xhost Unable to Open Display' Issue

When trying to run various GUI applications on my linux server I kept getting the following error:

No protocol specified
xhost:  unable to open display ":0.0"

The issue was due to access control; users connecting from a remote host are not allowed to open the display. To lift these constraints and fix the problem run the following command:

> sudo xhost +

Add the following to your .bashrc script (or whatever your shell’s equivalent is):

> export DISPLAY=:0.0

Finally whenever logging into your remote server, remember to use the -Y flag to enable X11 window forwarding.

> ssh username@hostname -Y