Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a setup of three machines.

Machine A runs a vncserver and an ssh server, Machine B runs a vncviewer, Machine C runs an ssh client.

The vncviewer on B connects to the vnc server on A.

The ssh client on C connects to the ssh server on A.

Is it possible that from the ssh session in C I spawn a process ( say xclock) on A so that the process shows up in the vncviewer on B's screen. Basically I am looking for the value to set DISPLAY variable to so that this can be achieved.

PS : Please reword the title of my question if you find that it doesn't appropriately describe my question

share|improve this question
    
About the X cookie, see Open a window on a remote X display (why “Cannot open display”)? –  Gilles Apr 17 '12 at 23:23

1 Answer 1

up vote 3 down vote accepted

Yes. Just set DISPLAY to the same value as in the VNC session. (Start a terminal window in the VNC session and type echo $DISPLAY. That's the value you need to use.)

share|improve this answer
    
okay that works, but only after I do xhost + on the machine with vncviewer :( Is there any work around for that ? –  AnkurVj Apr 17 '12 at 10:26
    
Is the user running the vncserver the same as the user logged in via ssh? You can grant access to only the necessary user; read up on man xhost. –  cjm Apr 17 '12 at 10:44
    
@AnkurVj without opening up access with xhost, you would have to transfer the x authorization cookie to server C so that it can properly authenticate. –  Patrick Apr 17 '12 at 10:59
    
actually I don't mind insecure environment, as I am running experiments. I just wanted that once I start vncviewer on C I should be able to forward X on that terminal without having to type any xhost command –  AnkurVj Apr 17 '12 at 11:01
1  
@AnkurVj After re-reading the question, this shouldnt be required (and neither should running xhost). However to answer, xhost + removes all authorization checking meaning that absolutely anyone can connect to the X11 display (security hole). transferring the X cookie makes it so that you can authenticate properly and not have to open X11 to the world. If you want more elaboration, should probably just open up another question. Goes far beyond the scope of a comment. –  Patrick Apr 17 '12 at 12:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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