Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a setup where I need to forward X11 from my local machine (laptop) to a Virtual machine. The server hosting this VM cannot be reached directly from my laptop. I need to first login to a gateway and from this gateway, I can access the VM. How can I forward X11 from my laptop to this VM? I have tried following but these do not work:

  1. [laptop # ] ssh -X [gateway]

    [gateway # ] ssh -X [VM]

  2. [laptop # ] ssh -tX [gateway] ssh -X [VM]

I could forward X11 only till the gateway. (DISPLAY variable gets set on gateway)

share|improve this question

migrated from stackoverflow.com Jan 16 '11 at 5:38

This question came from our site for professional and enthusiast programmers.

1 Answer 1

What you need to do is to use port forwarding so that you can ssh to the remote machine via port forwarding and then do ssh -X.

ssh -L 2222:[VM]:22 [gateway]
ssh -p 2222 -X localhost

or

ssh -R 2222:[VM]:22 [gateway]
ssh -p 2222 -X [gateway]
share|improve this answer

Your Answer

 
discard

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