My situation: I want to remotely debug my c++ application with gdbserver and eclipse. Eclipse is running on my local workstation (in the network) and gdbserver is running on a clustermachine in the network. I have ssh access to the clustermachine via a machine that is in both networks.

How can I set up a tunnel so that my eclipse can access the gdbserver? I don't have administrator rights/root/sudo access.

All the machines are linux/Unix with openssh.


I trust you can already SSH to a system on the remote private network ( If your local system is running openssh, add to your $HOME/.ssh/config:

Host gatewaymachine
  LocalForward 12080 remote_ip:portnum

Where 'remote_ip' is the IP address of the remote clustermachine system where gdbserver runs, and portnum is the port that it listens on. SSH to gatewaymachine, then connect your application to localhost, port 12080. For example if this is a web application


If you're not using a web application, you'll need to set up your connection information to reflect that you're going to 'localhost' port '12080' (or whatever port you like, see below).

Instead of editing your ssh config, you can also use ssh command parameters:

ssh -L 12080:remote_ip:portnum gatewaymachine

(change 12080 to whatever port you want above 1024; below 1024 and you'll need root access to bind to the port)

  • I can not directly ssh to clustermachine. Only via gatewaymachine. How can I incorporate that extra step? – Peter Smit Jul 9 '09 at 7:54
  • edited my answer, s/clustermachine/gatewaymachine/, and remember that remote_ip will be the IP of the clustermachine where your app is running and listening on 'portnum' – jtimberman Jul 9 '09 at 8:25

Basically, what jtimberman said :). You might want to look into autossh if you have trouble keeping your tunnel up for extended periods of time.

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.