Jupyter Notebook From Remote Machine

Here’s how you host a Jupyter Notebook on a remote server that you can access on your local browser. First, ssh into the remote server and type

jupyter notebook --no-browser --port=8889

You should see a token that looks like:

jupyter notebook --no-browser --port=8889
[I 16:40:54.686 NotebookApp] Serving notebooks from local directory: /home/groh
[I 16:40:54.686 NotebookApp] 0 active kernels
[I 16:40:54.687 NotebookApp] The Jupyter Notebook is running at:
[I 16:40:54.687 NotebookApp] http://localhost:8889/?token=eb38cdxxxxxxxxx
[I 16:40:54.687 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:40:54.687 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8889/?token=eb38cdxxxxxxxxx

On your local machine, type

ssh -i ~/.ssh/id_rsa -N -f -L localhost:8889:localhost:8889 user@hostname.com

And, now just copy and paste the token into your browser and you’re up and running.