1

I wanted to trouble shoot a certain issue on the server, but I could not connect my debugger since the person who maintains the firewall is off on a vacation. I dont want to mess with his settings. He has given me admin password though.

So for my purpose I need to attach a debugger to a Java program running on the server. When I do "jdb -attach port" on the server via ssh it works. I want to use eclipse in my machine to connect to that port. So this is what I think is the best thing to do in my situation.

Run a program listening on the server, run a program on my machine and make them talk thru SSH. Then my eclipse will connect to the local program which will talk to the servers local application which will attach me to the JVM process. (Profit!!!:)

I am not sure how to do this. I have a vague idea that I should be using netcat. But can you please help me with how to launch netcat or any other program for this purpose on both ends.

Your help is greatly appreciated. Thank You.

3
  • 2
    +1 for the new title ;) Dec 21, 2009 at 3:49
  • 5
    The new title is terrible, it completely fails to describe the nature of the problem.
    – womble
    Dec 21, 2009 at 4:13
  • True, but I wasn't sure if the old title contained a suggestion for a solution, I wasn't sure if I should be suggesting the solution since I did not have a lot of clue. So I made it generic. But it is bad in that it sure does not give any more information. Thanks for your solution womble.
    – Senthil
    Dec 21, 2009 at 10:20

1 Answer 1

5

To open a port 12345 on your local machine that, when connected to, will connect to a port 54321 on remotemachine (the machine you're SSH'd into):

ssh -L 12345:localhost:54321 remotemachine
3
  • The remote port 54321 is already bound and the debugger server is listening on it. When I issue this command I get "port already bound" message.
    – Senthil
    Dec 21, 2009 at 16:28
  • SSH doesn't bind on the remote port, it tries to connect to it. Something else is going on here; output of ssh -vvv -L 12345:localhost:54321 remotemachine might help.
    – womble
    Dec 21, 2009 at 19:22
  • I found these two switches helpful. -f and -N ssh -f user@remote -L 54321:localhost:12345 -N
    – Senthil
    Dec 23, 2009 at 17:01

You must log in to answer this question.