ass*_*321 5 ssh xorg x11-forwarding sshd
尝试通过 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:
Run Code Online (Sandbox Code Playgroud)
我总是能够通过 ssh 打开应用程序,这只是昨天开始的。在两台机器上都使用 ubuntu 16.04。
请不要将此标记为重复问题,以下解决方案没有帮助:
gksu: Gtk-WARNING **: 无法打开显示: :0
Gtk-WARNING **:无法打开显示:在 Ubuntu 服务器上
(nautilus:13581): Gtk-WARNING **: 无法打开显示:
如果需要具体信息,请询问,我会尽力回答。
你有必要告诉我们三件事。
你跑了吗
$ ssh -Y whatever.com
Run Code Online (Sandbox Code Playgroud)
或者
$ ssh -X whatever.com
Run Code Online (Sandbox Code Playgroud)
如果您既没有 -X 也没有 -Y,则 X11 转发将不起作用
如果不想每次需要 X11 转发时都输入 -X,可以通过编辑 /etc/ssh/ssh_config.conf 将其设置为默认值。这不是机器的服务器配置,它是所有客户端的默认设置。在我的底部,我有
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
Run Code Online (Sandbox Code Playgroud)
我希望这些更改在您注销之前不会产生任何影响,但我可能错了。
在服务器上,在文件 /etc/X11/sshd_config 中,需要使用类似的行打开 X11 转发
X11Forwarding yes
Run Code Online (Sandbox Code Playgroud)
请注意,在服务器重新启动或至少其 ssh 服务器重新启动之前,更改不会生效。
让我们知道它是如何工作的。如果失败,请报告配置文件和您运行的内容。
归档时间: |
|
查看次数: |
43607 次 |
最近记录: |