關於DISPLAY變量顯示問題


DISPLAY用來設置將圖形顯示到何處

在本機上直接登錄之后,startx,可以發現display變量自動設置為

[oracle@kel ~]$ echo $DISPLAY
:0.0
不論使用何種用戶來在本機直接登錄,都是顯示此值

[root@kel ~]# echo $DISPLAY
:0.0

DISPLAY環境變量格式如下host:NumA.NumB, host指Xserver所在的主機主機名或者ip地址, 圖形將顯示在這一機器上

如果Host為空, 則表示Xserver運行於本機

Xserver默認情況下不允許別的用戶的圖形程序的圖形顯示在當前屏幕上. 如果需要別的用戶的圖形顯示在當前屏幕上, 則應以當前登陸的用戶, 也就是切換身份前的用戶執行

[kel@kel ~]$ xhost +
access control disabled, clients can connect from any host

如果以上不行,則可以嘗試一下的環境變量的設置:

第一個:

export DISPLAY=localhost:11.0  --注意修改11的值,監聽端口為6011,從而此值為6011-6000=11
根據監聽端口來配置:

[oracle@kel ~]$ netstat -tnpl
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:40295             0.0.0.0:*                   LISTEN      4862/ocssd.bin      
tcp        0      0 127.0.0.1:37615             0.0.0.0:*                   LISTEN      4862/ocssd.bin      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:657                 0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      -                   
tcp        0      0 127.0.0.1:6011              0.0.0.0:*                   LISTEN      -                   
tcp        0      0 :::22                       :::*                        LISTEN      -                   
tcp        0      0 ::1:6010                    :::*                        LISTEN      -                   
tcp        0      0 ::1:6011                    :::*    


第二個:

[oracle@kel ~]$ IP=`w|grep 'w$'|awk '{printf $3}'`
[oracle@kel ~]$ echo $IP
192.168.1.1
[oracle@kel ~]$ export DISPLAY=$WIP:0.0



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM