Sunday, June 11, 2023

Launching Firefox (with a snapd installation) in Lubuntu to an xdisplay server using Putty, X11 forwarding and Xming

Launching Firefox from a snapd installation in Lubuntu to an xdisplay server using Putty, X11 forwarding and Xming


The purpose of this article is to record and summarise the process to setup X11 forwarding with Putty and a Lubuntu installation so that a GUI based application can be executed on the same system as the putty client. Most setups worked for native usr binaries such as xclock, xeyes (located in the /usr/bin/xclock) directory but for applications located in other directories such as /snap/bin the following error is shown below: 

PuTTY X11 proxy: Unsupported authorisation protocol

Error: cannot open display: [PCNAME]:10.0

Copying the .Xauthority file to the root home directory did not work.
But launching with the XAUTHORITY=$HOME/.Xauthority /path/to/binary-file command worked.

e.g. XAUTHORITY=$HOME/.Xauthority /snap/bin/firefox


Simple rough steps:


Install Lubuntu


Install OpenSSH

apt install openssh-server -y

systemctl enable ssh


Allow port 22 

sudo ufw allow ssh

sudo ufw enable


Download, install and launch Xming and fonts (fonts optional)

https://sourceforge.net/projects/xming/files/Xming/6.9.0.31/

https://sourceforge.net/projects/xming/files/Xming-fonts/7.7.0.10/




Configure Putty session with X11 forwarding 

Before -->
After -->



Webpage URL with the full details: https://appuals.com/putty-x11-proxy-error/


Configure sshd_config as follows

sudo vi /etc/ssh/sshd_config

Make the following changes. Uncomment as necessary as save.


X11Forwarding yes

X11DisplayOffset 10

X11UseLocalhost no

PrintMotd no

TCPKeepAlive yes


NB: DO NOT add the following entry in the sshd_config file as the ssh server will report an error and may not start.

ForwardX11Trusted yes    <-- DO NOT ADD IN FILE


Restart services as required

sudo systemctl restart ssh.service



Forum Post on X11 forwarding and launching /snap/bin/firefox 

https://www.reddit.com/r/linuxquestions/comments/wypz4v/x11_forwarding_question/


 Never mind, I figured it out.

22.04 installs firefox as a snap by default and that does not correctly handle xauth authentication. I installed a non-snap version and it now works as expected. It also works with the snap version if I run

XAUTHORITY=$HOME/.Xauthority /snap/bin/firefox





Additional troubleshooting steps to determine xauth is working

https://stackoverflow.com/questions/46277419/x11-proxy-unsupported-and-wrong



Launching another instance of X

https://unix.stackexchange.com/questions/85383/how-to-start-a-second-x-session

startx -- :1
NB: To be done in a console not in a putty/TTY session.

How to find the list of GUI applications in a Linux installation
https://askubuntu.com/questions/1091235/how-to-get-the-list-of-all-application-installed-which-has-gui

Naresh
20230611










No comments:

Post a Comment