R studio server, can't forward to port 8787

Hi there,

We have an instance of R studio running on port 8787. We can access it normally from work using:

When not at work, after connecting to work VPN, we normally set an ssh forward using:

ssh -N -f -L localhost:8787:localhost:8787 username@server_url

And then, access R studio through a browser using the address: localhost:8787

Recently, we have been unable to access R studio from outside work (from work, it is still fine)

SSH forwards to other ports continue to work normally, but forwards to port 8787 don't seem to work anymore.

Any reason what could be causing this? Any help will be highly appreciated.


Here is the output of sessionInfo() from R

R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0


attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.4.4

Sorry for the late reply here. I'm not 100% sure I'm tracking what is breaking. Can you share an example of an "SSH forward to another port" that works? You could be running into port conflicts if you have something listening on port 8787 locally (i.e. a docker container of RStudio or something).

For example, I have an instance of jupyter notebook running on port 8700. I can access it through:
localhost:8700, after setting up an ssh forward using:
ssh -N -f -L localhost:8700:localhost:8700 username@server_url

Not sure how to check for that, but here is the output of `sudo netstat -anp | grep -i ':8787':

tcp        0      0  *               LISTEN      29682/rserver
tcp        0      0 server_ip:8787       server_ip:55659      ESTABLISHED 29682/rserver
tcp6       0      0 ::1:8787                :::*                    LISTEN      51486/ssh

Does that look normal? Anything else I can try to diagnose?
Thanks a lot


Ohh ok. So port forwarding other services work fine. I was mistaken, thinking you meant you could forward port 8787 on the server to some other port locally. If other services port-forward fine, then my money is either on (1) port conflict on server, (2) port conflict locally, or (3) firewall / ip access rules.

Do you mind sharing who owns the ssh process 51486? i.e. is it you? I do not have a process like that on my server - is that someone's SSH tunnel? It looks like it could potentially conflict with 8787 traffic, although maybe it is ipv6 traffic? I forget what the different netstat stuff means :stuck_out_tongue: It could be possible that someone borked an SSH tunnel with -R and are now listening on port 8787, which is what you are mapping to your local host (i.e. their service, not RStudio Server).

I was thinking mostly of port conflicts on your local machine, if you have another process running that is listening on port 8787. What is your local machine? Mac / Windows / Linux?


You nailed it!
Process 51486 was a port forwarding command mistakenly launched from the server by one of the users (instead of being launched from his local machine). After I killed that process, everything works fine.
Thanks a lot !

1 Like

Glad to hear it and glad that we could help! Always nice to have a bug out of the system! :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.