Trying to access remote jupyter notebook via ssh tunnel

SirYansalot picture SirYansalot · May 25, 2016 · Viewed 7.8k times · Source

I need some help accessing a remote jupyter notebook instance

normally, when I am trying to access a jupyter notebook running on a remote server on my mac, I will write the following in a terminal window to create the tunnel

ssh -NL $local_port_number:localhost:$remote_port_number $my_username@$remote_server

afterwards, I can usually access the jupyter server at http://localhost:local_port_number

how do I do this in putty on windows? I know there is some option in connection>>ssh>>tunnels to do this, but I cannot get the configuration to work so far.

Answer

Aerin picture Aerin · Feb 18, 2018

In remote host, open the terminal, change directory to where you have your notebooks and type:

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

# you should leave the this open

In your local computer, open MS-DOS cmd (if using Windows) or Unix terminal, then type:

ssh -N -f -L localhost:8888:localhost:8889 username@your_remote_host_name

# make sure to change `username` to your real username in remote host
# change `your_remote_host_name` to your address of your working station
# Example: ssh -N -f -L localhost:8888:localhost:8889 [email protected]

Now open web browser (google chrome, firefox, ...) and type:

localhost:8888
# you will see your notebooks in your given directory

From: http://amber-md.github.io/pytraj/latest/tutorials/remote_jupyter_notebook