Access Jupyter Notebooks over SSH tunnel

I’m currently running some analyses on a virtual machine in the cloud, and it turns out that there is a really neat way to access Jupyter Notebooks remotely without installing Jupyter Hub. So if you (like me) just run the notebooks for yourself and don’t need multi-user support and the like, you can simply SSH into your remote machine (replacing username and host, obviously:

ssh -L 9999:localhost:9999 username@host

Enter your password for the remote machine when prompted, and, when logged in, start a notebook server and tunnel the output to your local port 9999:

jupyter notebook --port 9999 --no-browser

Starting the notebook server this way will make it show a URL that you simply paste into your local browser, et voilà – a Jupyter Notebook with code executed in the cloud.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.