SSH X11 Forwarding not working properly
I am trying to display windows from a Linux machine on my MacBook Air (macOS 11.0.1). I ssh into the Linux machine with "ssh -XY username@linuxhost". Ever since Catalina, I have not been able to successfully display windows and get the following error message:
Unable to init server: Could not connect: Connection refused
(eog:14338): Gtk-WARNING **: 10:55:26.520: cannot open display: localhost:11.0
I have tried every single fix I could find online including:
- Changing the settings in .ssh/config on my MacBook (ForwardX11 yes, ForwardX11Trusted yes, XAuthLocation /opt/local/bin/xauth)
- Changing those same settings in the system wide file (/usr/local/etc/ssh/ssh_config)
- Changing some of the settings in the Linux machine sshd_config file
- Using the command "xhost +" on my MacBook
- Using -X or -Y flags in my ssh command
Those are the main solutions people offer, but none of them have worked for me. It worked perfectly before upgrading to Catalina, and older MacBooks (macOS 10.12 and below) can still display windows from this Linux machine just fine. This MacBook can display things from other computers just fine too.
I have stumbled upon a very strange behavior. If I ssh into the Linux machine in one terminal, it does not display things. If I open a second terminal and ssh into the Linux machine while keeping the first terminal open and logged in, I can successfully display things. With both terminals open, the first one works properly now. If I close the second terminal, the first one stops working again. But if I close the first terminal, the second one continues to work. I have no idea what that means, but maybe it can help someone else to diagnose the problem.
MacBook Air 13″, macOS 10.15