Thursday, August 20, 2015

Simple way of fixing X session

How to get X working , please note that here michael.test.com is the machine on which I want the display from myserver

Run Xming on michael.test.com it should say something like when you hover your mouse over the icon in tray.
Xming Server:0.0

(test): xclock
Xlib: connection to "michael.test.com:0.0" refused by server
Xlib: No protocol specified
Error: Can't open display: michael.test.com:0.0
(test):
(test): echo $DISPLAY
michael.test.com:0.0
(test):
(test): xauth list
myserver/unix:10  MIT-MAGIC-COOKIE-1  5575e26248071e145e630e8745b0f554
myserver/unix:12  MIT-MAGIC-COOKIE-1  b44ddd637303137437a3bf34468a1346
myserver/unix:11  MIT-MAGIC-COOKIE-1  d3d6f7ac86a18327dfga81e676ae2d7
myserver/unix:13  MIT-MAGIC-COOKIE-1  984ced6437a8a506484feaafe5aa4455
myserver/unix:14  MIT-MAGIC-COOKIE-1  cd803be0917742c5b646dd29aba68235
myserver/unix:15  MIT-MAGIC-COOKIE-1  b13db84fefa33c9858cf811dd7f8d4f5
(test): DISPLAY=localhost:14.0
(test): xclock
Xlib: connection to "localhost:14.0" refused by server
Xlib: SSH gateway: X11 authentication failed.
Error: Can't open display: localhost:14.0
(test): DISPLAY=localhost:15.0
(test): xclock

Hurray it is working now !!!


Basically pick the last number from myserver/unix:15 and set display for it.


Another example:

[root@rac1 ~]# echo $DISPLAY
localhost:10.0
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# xclock
Warning: Missing charsets in String to FontSet conversion

CLOCK IS DISPLAYING 

[root@rac1 ~]# 
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ echo $DISPLAY
localhost:10.0
[oracle@rac1 ~]$ xclock
SSH gateway: X11 authentication failed. Error: Can't open display: localhost:10.0
[oracle@rac1 ~]$ xauth list
xauth:  creating new authority file /home/oracle/.Xauthority
[oracle@rac1 ~]$ logout
[root@rac1 ~]# xauth list
rac1.localdomain/unix:11  MIT-MAGIC-COOKIE-1  a07e89ae73d89bb53a6c77aec2cc97b4
rac1.localdomain/unix:12  MIT-MAGIC-COOKIE-1  a07e89ae73d89bb53a6c77aec2cc97b4
rac1.localdomain/unix:10  MIT-MAGIC-COOKIE-1  fc8bcd8b030407cd72074daf40af33e1
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ xauth add rac1.localdomain/unix:10  MIT-MAGIC-COOKIE-1  fc8bcd8b030407cd72074daf40af33e1
xauth:  creating new authority file /home/oracle/.Xauthority
[oracle@rac1 ~]$ xclock
Warning: Missing charsets in String to FontSet conversion

Hurray it is working now !!!


[oracle@rac1 ~]$