Skip to content

Instantly share code, notes, and snippets.

@sepastian
Last active October 26, 2022 09:25
Show Gist options
  • Save sepastian/851720529c37c2932d21396138866a39 to your computer and use it in GitHub Desktop.
Save sepastian/851720529c37c2932d21396138866a39 to your computer and use it in GitHub Desktop.
Jupyter notebook on remote host via SSH tunnel
# SSH into remote host "R", startup Jupyter on port XXXX.
ssh [email protected]
jupyer notebook --no-browser --port=XXXX
# On the localhost "L", accessing jupyter via the browser:
# create a reverse tunnel, forwarding YYYY (L) to XXXX (R).
ssh -N -L YYYY:localhost:XXXX [email protected]
---- --------- ----
| | |
| | ` port on remote where Jupyer is listening
| ` same hostname on local and remote machine
` local port, forwarded to remote port via SSH
# Jupyter protects access to notebooks with a token.
# To find out the token, SSH into R from L, then list all servers.
ssh [email protected]
jupyter notebook list
# Now simply click on the link named http://localhost:XXXX/?token=...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment