Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone give me any hint with this situation. I have my desktop-computer (running on Ubuntu) in my company. Company has vpn gateway which helps me to connect my desktop-comuter via ssh. Now I want to remotely control my desktop-computer at home with VNC. I have already installed xtightvncserver and its already running in my desktop-computer.

How can I create ssh tunnel between my-laptop and company-gw to use vnc-client? Somebody's detailed info would be appreciated. I would like to name my computers as following.

company-pc - desktop computer at work (vnc server)

company-gw - vpn gateway at company (which runs openssh server)

my-laptop - my laptop computer at home (vnc client)

share|improve this question

migrated from Dec 29 '12 at 17:44

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

As I understand your question, you cannot connect from company-pc or company-gw to my-laptop, but you can connect from my-laptop to company-gw, and from company-pc to company-gw. Is that right? I don't know what the desktop-computer you refer to is.

If my-laptop is running sshd, try this:

From my-laptop, when you're still at home:

ssh -R 8022:localhost:22 myusername@company-gw

Once logged in, connections made (from anywhere) to port 8022 on company-gw will be forwarded to port 22 on my-laptop. Stay logged in when you go to work.

At work, from company-pc:

ssh -L 5900:localhost:5900 -p 8022 myhomeusername@company-gw

You are actually ssh-ing into my-laptop when you do this, since port 8022 on company-gw is forwarded to port 22 on my-laptop. You are now forwording port 5900 on company-pc to port 5900 on my-laptop (since "localhost" in this command is what my-laptop called localhost).

Now vnc into localhost. That connects to port 5900 on your own company-pc, which is forwarded, via company-gw, to my-laptop.

If any of the forwarded ports is in use, just try a different number (8023 instead of 8022, 5901 instead of the first 5900) until you get to a free one

share|improve this answer

Your Answer


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.