0

I'm running a program that lets you interact with it in the browser. To do this you run the program and open "localhost:8080" in your browser (if 8080 is the right port).

However, I'm running the program on a server, and trying to access it on my own computer with my own browser through a SSH connection. This means I must use the same port in my SSH connection as the program uses. But that doesn't work, my theory is that the program and my SSH connection are fighting over the port.

So my question is, in other words: How do I access port 8080 on the server, without using port 8080 for the SSH connection?

Additional note: I have tried using X-forwarding (-X option) in my SSH connection, and running a browser on the server. That works, but is excruciatingly slow.

  • There are ways to speed up the display of your browser while running on the server, but what you need is to setup port forwarding using ssh. You can do so from another terminal, or before you make the normal ssh connection. revsys.com/writings/quicktips/ssh-tunnel.html – Anthon Mar 11 '15 at 13:42
1

Rather than running the browser on the remote server, use an ssh tunnel to forward a local port to the remote server's local port.

Assuming you have port 8080 on the remote host, this command will create a listening port 8080 on your local machine (the first localhost:8080) and tunnel any connections to it across to localhost:8080 run in the context of the remote host - i.e. port 8080 on that remote_host itself. The -f tells the ssh to continue running in the background; omit this if you want the ssh session to remain open in your terminal.

local$ ssh -f -L localhost:8080:localhost:8080 remote_host
local$ firefox http://localhost:8080/
  • That did the trick. Awesome thanks a bunch. – Ólavur Mortensen Mar 11 '15 at 13:45
0

Not sure I understand your question correctly, and first of all SSH is running by default on port 22.

Now what would be interesting is for you to check first, if sshd is running, and checking the port on which it is running if you modified the config file.

One note, if you're running your web interface on port 8080 (and it is constantly listening), you won't be able to connect to any other application through this port.

  • I'm using: ssh -L 9000:localhost:9042 user@server_ip For example, to specify both the in-going and out-going port. – Ólavur Mortensen Mar 11 '15 at 13:04
  • So let me get this straight, you are using ssh to connect to the server, then you want to open a web browser with your ssh session on the server? – Adonis Mar 11 '15 at 13:08
  • It looks like SSHD is running, and uses port 22, according to the config file. – Ólavur Mortensen Mar 11 '15 at 13:08
  • Correct, I want to access a specific port on the server. – Ólavur Mortensen Mar 11 '15 at 13:10
  • According to what you are saying, your program should run on port 8080 assuming nothing is already using that port, and this program should manage the ssh connection, perhaps look at the config file of your program... Still not sure I understand your request – Adonis Mar 11 '15 at 13:16

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.