When I am physically in the office, both the "local" and the "remote" machines are behind the same firewall, and the "remote" machine is accessible by simple ssh command: ssh username@local_IP_of_the_remote_server. Then, the following steps get me to access a "Jupyter lab session" hosted on a more powerful "remote" machine by visiting localhost:7777 on a "local" machine:

  • On the "remote" machine, fire: jupyter lab --no-browser --port=7777;
  • On the "local" machine, issue the following tunneling command to "grab the port 7777 to the local machine": ssh -Y -N -L localhost:7777:localhost:7777 username@local_IP_of_the_remote_server

Got tunneling to work with SSH

I wonder if it is possible to use the "Jupyter lab session" when I am physically out of office? For now, I can visit the "remote" machine in the office by the following steps:

  • Step 1: on the "reomte" server, issue command: ssh -R user_on_VPS@IP_for_VPS; (I also set GatewayPorts yes in /etc/ssh/sshd_config to accompany the wildcard)
  • Step 2: on arbitrary machine that is roaming out of the office, use port 2210 on the VPS to establish SSH connection, by: ssh -p 2210 user_on_VPS@IP_for_VPS

Failed with getting tunneling to work for the Jupyter thing

Here goes my failed attempt:

  • Step 1: on the "remote" machine, ssh -R user_on_VPS@IP_for_VPS
  • Step 2: on the "local" machine that is roaming out of the firewall: ssh -Y -fN -L localhost:4349:localhost:4349 user_on_VPS@IP_for_VPS


  1. How to tweak the ssh command to get localhost:4349 usable by a "local" machine that is roaming out of the firewall?
  2. Would it be safer to only open ports for Jupyter notebook compared to hosting reverse tunneling at all times?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.