2

I have a vncserver running on a RHEL 6.8 box. When I access this session via a VNC viewer, I notice that I cannot run x programs (like xterm) if I modify the DISPLAY variable to include the server's hostname. For example:

[foo][/home/user]>echo $DISPLAY
:5.0
[foo][/home/user]>xhost +
access control disabled, clients can connect from any host
[foo][/home/user]>xterm

<xterm window opens - I type 'exit' in the xterm to close it>

[foo][/home/user]>hostname
foo.mydomain.com
[foo][/home/user]>export DISPLAY=foo.mydomain.com:5.0
[foo][/home/user]>xterm
xterm Xt error: Can't open display: foo.mydomain.com:5.0
[foo][/home/user]>xhost
xhost:  unable to open display "foo.mydomain.com:5.0"
[foo][home/user]

I can ping to myself using this hostname:

[foo][/home/user]>ping foo.mydomain.com
PING foo.mydomain.com (192.168.1.200) 56(84) bytes of data.
64 bytes from foo.mydomain.com (192.168.1.200): icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from foo.mydomain.com (192.168.1.200): icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from foo.mydomain.com (192.168.1.200): icmp_seq=3 ttl=64 time=0.029 ms

Here's the VNC entry in the process list:

user   22129     1  0 16:15 pts/70   00:00:22 /usr/bin/Xvnc :5 -desktop foo.mydomain.com:5 (user) -auth /home/user/.Xauthority -geometry 1270x1014 -rfbwait 30000 -rfbauth /home/user/.vnc/passwd -rfbport 5905 -fp catalogue:/etc/X11/fontpath.d -pn

And the contents of .Xauthority:

[foo][/home/user]>xauth
Using authority file /home/user/.Xauthority
xauth> list
foo.mydomain.com:5  MIT-MAGIC-COOKIE-1  <long hex value>
foo.mydomain.com/unix:5  MIT-MAGIC-COOKIE-1  <same long hex value as above>
xauth> 

DISCLOSURE: I realize that whether DISPLAY contains the hostname or not makes little difference on the local system. The issue I'm really trying to figure out is why I have the same problem exporting a DISPLAY from a remote host to this VNC server - I get the same "Can't open display" message. In the past when I've gotten that message, the problem was always xhost not allowing remote connections. But this time setting "xhost +" did not help. I thought the fact that using a hostname in the DISPLAY var on the local machine also triggering the problem was a clue.

Any thoughts on how to debug this problem? Thanks!

0

Try to add -listen tcp in VNCSERVERARGS:

VNCSERVERARGS[2]="-geometry 800x600 -listen tcp"

or, if you are opening the session directly from command line:

vncserver -listen tcp
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.