Launch and use IPython notebook on the network

Thing you want to do

I want to start the ipython notebook server on a machine on the network and use it from the browser on the local machine.

The local machine is a weak macbook air, so I want to work on a powerful machine on the net. Also, if you can do this, you can work anywhere.

However, the ipython notebook is an interactive, graphical REPL that allows you to execute arbitrary code. This is also a huge security hole, so I would like to take measures that can be reassured.

solution

The remote machine blocks all but the ssh port with a firewall, and the notebook is accessed via the ssh tunnel.

There is also a password protection method, but it is not adopted.

Specific connection / startup

It will be the method on mac (I feel that it can be equivalent on windows).

For remote machines, use a firewall to prevent connections other than ssh.

Ssh to a remote machine. At this time, a "tunnel" is also opened. That is,

[local-machine]$ ssh -L 8080:127.0.0.1:8888 remotemachine

Connect with ssh as [^ 1]. This will open a "tunnel" at the same time that the usual ssh session is available in the terminal, so you can access localhost: 8080 to access remote port 8888 through the ssh session. Note that 8888 is the default port for notebooks.

[^ 1]: Suppose that remotemachine is already defined in ~ / .ssh / config, and normally ssh remotemachine is set to allow ssh connection.

On top of that

[remote-machine]$ ipython notebook --profile=nbserver --no-browser

As, start the notebook server [^ 2].

[^ 2]: When I try to launch a notebook without the --no-browser option on a machine with a GUI, the browser launches and tries to open the notebook.

After starting the server, access localhost: 8080 with a browser on your local machine to open the notebook. On the other hand, accessing * ip-address-of-remote-machine *: 8888 is denied.

Weaknesses of this method

ssh connection lost. You can prevent the notebook server from going down by starting the notebook server in a screen or tmux session, but you need to ssh it again to connect to the browser. After all, is the official method (certificate + password) better?


Recommended Posts

Launch and use IPython notebook on the network
Launch the IPython notebook server
Use AppSync on the front and back ends
Easily launch jupyter notebook on AWS and access locally
[Windows] [Python3] Install python3 and Jupyter Notebook (formerly ipython notebook) on Windows
Displaying strings on IPython Notebook
How to use IPython Notebook
Run IPython Notebook on Docker
Use Bokeh with IPython Notebook
I tried to launch ipython cluster to the minimum on AWS
Sakura Use Python on the Internet
Install Anaconda on Mac and upload Jupyter (IPython) notebook to Anaconda Cloud
Use The Metabolic Disassembler on Google Colaboratory
IPython Notebook is now rendered on GitHub!
Use apache Spark with jupyter notebook (IPython notebook)
Specify the browser to use with Jupyter Notebook. Especially Mac. (And Vivaldi)
Use Jupyter Lab and Jupyter Notebook with EC2
Install and launch k3s on Manjaro Linux
Use the Grove sensor on the Raspberry Pi
Clone the github repository on jupyter notebook
Deploy and use the prediction model created in Python on SQL Server
Use vim keybindings on Docker-launched Jupyter Notebook
How to use the IPython debugger (ipdb)
Add lines and text on the image
Graph analysis and visualization on IPython Notebook using Cytoscape / cyREST and py2cytoscape Part 1
Use python on Raspberry Pi 3 and turn on the LED when it gets dark!
Install matplotlib and display graph on Jupyter Notebook
code-server online environment (4) Launch code-server on the EC2 instance
Use the latest version of PyCharm on Ubuntu
Find and delete memory-hungry variables on Jupyter (IPython)
Use emacs or vim keybindings in IPython notebook
I ran the neural network on the actual FPGA
Remotely open Jupyter notebook launched on the server
Introducing Spark to EC2 and linking iPython Notebook
The story of launching python2.x jupyter notebook using docker (crushed on Saturday and Sunday)
I tried to understand how to use Pandas and multicollinearity based on the Affairs dataset.
Until you install Anaconda for data analysis on your Mac and launch the IDE
[Python] A notebook that translates and downloads the ipynb file on GitHub into Japanese.
ipython notebook installation
IPython Notebook Recommendations
Read the csv file with jupyter notebook and write the graph on top of it
Run the flask app on Cloud9 and Apache Httpd
Specify the volume on linux and make a sound
Visualize network data using Cytoscape from IPython Notebook Part 1
Monitor the training model with TensorBord on Jupyter Notebook
EC2 provisioning with Vagrant + Jupyter (IPython Notebook) on Docker
How to use the grep command and frequent samples
How to instantly launch Jupyter Notebook from the terminal
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Execute the command on the web server and display the result
How to use argparse and the difference between optparse
Django-Overview the tutorial app on Qiita and add features (1)
Install django on python + anaconda and start the server
Use Python to monitor Windows and Mac and collect information on the apps you are working on