Skip to content

[Linux] How to use remote Jupyter Notebook via SSH

Last Updated on 2021-06-28 by Clay

Jupyter Notebook is a Python Editor (?) or you may think it is like an IDE, which is implemented by IPython.

Sometimes, we need to use GPU, but GPU is in the remote server. This time, we can open a specific port to connect remote port, and then we can startup our Jupyter Notebook in our localhost but connect the remote Python interpreter.


Method

First, we need to set the remote server Jupyter Notebook config.

jupyter notebook --generate-config

That will be generate a config file automatically. Now we set our connection password.

jupyter notebook password

Output:

Enter password:  PASSWORD
Verify password: PASSWORD

After successful setting, we confirm that the Jupyter Notebook is running at 127.0.0.1, port is 8888.

And then we go back to the local side. We can use the following SSH command:

ssh -L 18888:127.0.0.1:8888 USER_NAME@YOUR_IP

Key in the user password, connect, and startup remote Jupyter Notebook.

jupyter notebook

Then we directly enter on the web page of the local end:

http://127.0.0.1:18888

Usually you will see the a screen need you to key in the password, enter the Jupyter Notebook password you set, and you will be connected to the remote Jupyter Notebook.


References

Leave a Reply