Score:0

X11 Forwarding not working on Ubuntu 22.04

cn flag

I've read numerous similar questions but many are outdated and nothing seems to work. I have an homePC <remotehome> and a laptop <locallaptop>, both running Ubuntu 22.04.

I'm away from home, I can ssh into <remotehome> both with psw or private key.

sudo ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa -X -p 2022 remoteuser@<remotehome>

(the port is 2022 because of port forwarding on my home router, idk if relevant)

Once on remote host, xdg-open or firefox commands give me:

X11 connection rejected because of wrong authentication.
Error: cannot open display: localhost:10.0

Running xlogo on remote terminal actually opens a window on my local desktop.

Useful Info:

df -H

on remote terminal, plenty of space.

ls -l ~/.Xauthority

output:

-rw------- 1 remoteuser remoteuser 69 mar 22 15:23 /home/remoteuser/.Xauthority

X11 Forwarding is enabled on <remotehome>

X11Forwarding yes

in /etc/ssh/sshd_config.

On client X11 Forwarding is enabled.

Host *
ForwardX11 yes

in /etc/ssh/ssh_config

xhost command gives the same output from both the remote and local terminal:

access control enabled, only authorized clients can connect
SI:localuser:<my-username-in-local-laptop>

The $XAUTHORITY var on my local desktop is:

/run/user/1000/.mutter-Xwaylandauth.PLS211

I've tried the solution proposed here and here and here. Nothing seems to work. Any help to debug this issue is really appreciated.

hr flag
If `xlogo` forwards successfully, then X11 forwarding is working - what may not be working is the forwarding of snaps (which appears to be because the snap home interface does not allow access to the hidden .Xauthority file) - see for example [ssh connection. X11 connection rejected because of wrong authentication](https://unix.stackexchange.com/a/709789/65304) and [Canonical Snapcraft: X11 Forwarding using SSH](https://forum.snapcraft.io/t/x11-forwarding-using-ssh/2381/8)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.