Skip to content

Instantly share code, notes, and snippets.

@thomasaarholt
Last active March 21, 2019 14:51
Show Gist options
  • Save thomasaarholt/222a761520a03f2091dac8b03e184722 to your computer and use it in GitHub Desktop.
Save thomasaarholt/222a761520a03f2091dac8b03e184722 to your computer and use it in GitHub Desktop.
Remote Jupyter Notebook through ssh tunnel

Using Jupyter notebook remotely via a ssh tunnel.

Especially good for running on headless devices, such as supercomputers or clusters.

Remotely:

# remote_port should be value between 8888 and 9000
jupyter notebook --no-browser --port=remote_port

Locally, new terminal window

# remote_user is your username to the remote_host server
ssh -N -f -L localhost:8888:localhost:remote_port remote_user@remote_host

Example:

jupyter notebook --no-browser --port=8889
ssh -N -f -L localhost:8888:localhost:8889 [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment