Firefox from Terminal on remote Ubuntu 22.04 via VNC: Cannot open display

Disclaimer: I’m somewhat new to SSH and VNC servers, and while I get the basics, that’s about as far as it goes. If applicable, explaining like I’m five would be beneficial!

This is a similar issue as mentioned here, but the solution (checking /etc/ssh/sshd_config to ensure X11Forwarding was set to yes) failed to work; possibly because I’m utilizing Xtigervnc versus just ssh (if that’s a thing that can be done).

The exact output that firefox provides is;

Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
Authorization required, but no authorization protocol specified.
Error: cannot open display: :14

I am currently running my VNC Server on display 14, so it is indeed recognizing the proper display number. Every configuration file I can think to check and have been told to check online seems to come up negative on any problems that can cause this.

The server is running Ubuntu 22.04.1 LTS with a GNOME version of 42.5; the host system is Windows 11 Pro 22h2 (22621). I’m using VNC Viewer 7.0.1 to connect.

Asked By: EarthToAccess

||

Courtesy of steeldriver’s comment:

Assuming you are using the default (i.e. snap) version of firefox, the issue may be with the snap containment

It did appear to be an issue with snaps and registering XAuthority when forwarding X11 on my VNC. The issue was fixed by simply running the following commands in a Terminal window;

XAUTHORITY=$HOME/.Xauthority
export XAUTHORITY

Then, running Firefox via the Terminal would open it properly. It would not open via its icon in Applications/the Dash, however; using a desktop file is a workaround.

Answered By: EarthToAccess