Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I am trying to access my work computer (server C) via vnc. I have root on this machine. I can't access it directly so I have to go via server B. I have done the following steps.

First on my local machine I run

ssh -L 5900:serverC:5900 user@serverB

and then on serverC I ran

x11vnc -safer -localhost -nopw -once -display :0

However when I then do

vinagre localhost::5900

on my local machine it says it can't connect.

Both my local machine and serverC are running ubuntu. serverB is running CentOS and I don't have root on it.

What am I doing wrong?

If nothing, what's a good way to diagnose the problem? Is there some way to tell if serverB has port forwarding disabled? Is there a way to do port forwarding in user space?

share|improve this question
    
I think it should be vinagre localhost::0. To my knowledge, the command line for vnc clients takes a display number and maps it to a port number by adding 5900 to it. – Joseph R. Apr 17 '13 at 23:32
    
@JosephR Thanks. That's not the problem sadly. – Anush Apr 18 '13 at 7:23

Look at option #2 in the accepted answer on this related SuperUser question: ssh tunnel via multiple hops

Option #1 probably won't work for you unless you can send direct traffic from server B to server C outside of an ssh connection.

Option #3 won't work for you because it assumes that you're able to set up an ssh connection directly to server C.

share|improve this answer
    
Thanks. The problem is that 5900 is blocked on serverC it seems. I found way round it though. – Anush Apr 18 '13 at 7:57

This works although is a little complicated.

ssh -v -L 1200:serverC:22 user@serverB
ssh -v -L 5900:127.0.0.1:5900 -p 1200 user_from_serverC@127.0.0.1
x11vnc -safer -localhost -nopw -once -display :0
vinagre localhost::5900
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .