Skip to content

Instantly share code, notes, and snippets.

@donovanr
Last active April 26, 2017 20:13
Show Gist options
  • Select an option

  • Save donovanr/66e082d194119d87761e19aced8b881e to your computer and use it in GitHub Desktop.

Select an option

Save donovanr/66e082d194119d87761e19aced8b881e to your computer and use it in GitHub Desktop.
access jupyter notebooks running on compute nodes

Port forwarding using ProxyJump and ssh tunnels

These instructions assume an ssh client at least as recent as OpenSSH 7.3, otherwise the ProxyJump will fail.

  • set up a new host in your ~/.ssh/config file (change rorydm to your own username):
Host tartarus
    HostName n70
    ProxyJump qmaster
    User rorydm
    LocalForward 8888 localhost:9999

this will let you use e.g. ssh tartarus to connect directly to n70 without having to first log in to qmaster

you can then use the tartarus host like a normal host for port forwarding. say you set up your jupyter notebook on n70 to serve on port 9999.

  • use ssh tartarus on you local machine to log in to n70,
    • this will give you an interactive ssh session, while forwarding port 9999 on n70 to port 8888 on your local machine.
  • on n70, in the interactive ssh session, issue jupyter notebook
  • on you local machine, you should be able to see the notebook at http://localhost:8888/tree

i think it'd be possible to be fancier, e.g run jupyter notebook automatically on n70 etc, but this is pretty good for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment