X11 errors over SSH
Solution 1
It is necessary for you to tell us 3 things.
- What command did you use to launch your ssh session.
Did you run
$ ssh -Y whatever.com
or
$ ssh -X whatever.com
If you had neither -X nor -Y, X11 forwarding won't work
- Have you edited the ssh client configuration file on the client machine? If you changed that, tell us exactly what.
If you don't want to type -X every time you need X11 forwarding, it can be set as default by editing /etc/ssh/ssh_config. That's not the machine's server config, it is default for all clients. At the bottom of mine, I have
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
I expect these changes will have no effect until you log out, but I may be wrong about that.
- On the server machine, did you enable X11 forwarding?
On the server, in the file /etc/X11/sshd_config, it will be necessary to turn on X11 forwarding with a line like
X11Forwarding yes
Please note that change will not have an effect until the server is restarted, or at least its ssh server is restarted.
Let us know how that works. If it fails, report the config files and what you ran.
Solution 2
Have you disabled ipv6? If so I found the solution! Add AddressFamily inet to sshd_config.
Edit:
Perform the following steps:
- On the server, edit the file /etc/ssh/sshd_config .
- The default file should have "AddressFamily inet" commented out. Uncomment it and change the value from its default of "any" to "inet".
- Then restart the service: sudo service sshd restart .
Related videos on Youtube
assassin4321
Updated on September 18, 2022Comments
-
assassin4321 over 1 year
i get following errors when trying to open programs over ssh.
$ thunar Thunar: Cannot open display: $ libreoffice Failed to open display $ firefox Error: GDK_BACKEND does not match available displays $ keepassx keepassx: cannot connect to X server $ keepass2 Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable) Parameter name: Display at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) <0x41b3c8a0 + 0x00b9b> in <filename unknown>:0 at System.Windows.Forms.XplatUIX11..ctor () <0x41b3ab20 + 0x001df> in <filename unknown>:0 at System.Windows.Forms.XplatUIX11.GetInstance () <0x41b3a8d0 + 0x0005b> in <filename unknown>:0 at System.Windows.Forms.XplatUI..cctor () <0x41b3a160 + 0x00137> in <filename unknown>:0 --- End of inner exception stack trace --- at System.Windows.Forms.Application.EnableVisualStyles () <0x41b38870 + 0x0001b> in <filename unknown>:0 at KeePass.Program.Main (System.String[] args) <0x41b376c0 + 0x0008b> in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable) Parameter name: Display at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) <0x41b3c8a0 + 0x00b9b> in <filename unknown>:0 at System.Windows.Forms.XplatUIX11..ctor () <0x41b3ab20 + 0x001df> in <filename unknown>:0 at System.Windows.Forms.XplatUIX11.GetInstance () <0x41b3a8d0 + 0x0005b> in <filename unknown>:0 at System.Windows.Forms.XplatUI..cctor () <0x41b3a160 + 0x00137> in <filename unknown>:0 --- End of inner exception stack trace --- at System.Windows.Forms.Application.EnableVisualStyles () <0x41b38870 + 0x0001b> in <filename unknown>:0 at KeePass.Program.Main (System.String[] args) <0x41b376c0 + 0x0008b> in <filename unknown>:0 :06:22 PM~/Documents$ gimp Cannot open display: $ wireshark QXcbConnection: Could not connect to display Aborted (core dumped) $ gedit Failed to connect to Mir: Failed to connect to server socket: No such file or directory Unable to init server: Could not connect: Connection refused (gedit:23724): Gtk-WARNING **: cannot open display:
i've always been able to open aplications over ssh, this just started yesterday. using ubuntu 16.04 on both machines.
please DO NOT flag this as a repeat question, the following solutions didn't help:
gksu: Gtk-WARNING **: cannot open display: :0
Gtk-WARNING **: cannot open display: on Ubuntu Server
(nautilus:13581): Gtk-WARNING **: cannot open display:
if specific info is needed, please ask, i'll do my best to answer.
-
Admin almost 8 yearsHow about this this post on trust level? Sounds pretty much the same...
-
Admin over 7 yearsWhat happened yesterday? did you update, install or remove something?
-
-
Ray over 6 years@wjandrea I think it's great to encourage new users to refine their answers but let's balance that with the possibility of being too demanding. Because a new user could also decide, "Oh! Forget it...I'm just trying to help and it's just too much trouble! I won't post anything!". Just my point of view. I had the problem mentioned and Alroger Jr's solution was exactly what I needed; for someone who knows Ubuntu even a little, a "man sshd_config" would answer your questions. I'll try to edit his post with the information you ask for.