ubuntu 18.04 gedit不能使用以及xhost: unable to open display問題
阿新 • • 發佈:2019-01-07
1. SecureCRT上使用gedit不好用
因為gedit是基於視窗模式啊,而使用secureCRT進行ssh遠端操作是在終端下,所以gedit當然是不好用的,可憐我還當個問題準備解決。。。
終端模式下編輯文字應該使用vim,也可以是vi。
2. Gtk-WARNING **: 10:39:36.773: cannot open display:
伺服器遠端GUI圖形使用者介面使用的是VNC Viewer
在使用gedit開啟一個檔案時,出現如下提示:
Unable to init server: Could not connect: Connection refused
(gedit:3278): Gtk-WARNING **: 10:39:36.773: cannot open display:
原因:X server預設情況下不允許別的使用者的圖形程式的圖形顯示在當前螢幕上
解決辦法:執行xhost +,授予其它使用者訪問當前螢幕的許可權
3. xhost: unable to open display “”
而此時又出現瞭如下提示:
xhost: unable to open display ""
解決辦法:root許可權下,依次執行
vncserver :1
export DISPLAY=localhost:1
xhost +
實際操作過程如下:
[email protected]:~$ vncserver :1
New 'Server:1 (root)' desktop is Server:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/Server:1.log
[email protected]:~# export DISPLAY=localhost:1
[email protected]:~# xhost +
access control disabled, clients can connect from any host
出現access control disabled, clients can connect from any host即為成功
這裡比如開啟tomcat中bin資料夾下的startup.sh檔案
[email protected]:/usr/local/apache-tomcat-8.5.33/bin# gedit startup.sh
成功彈出介面
學習連結:https://blog.csdn.net/preamble_1/article/details/70883978