jupyter-notebook - 使用证书授予 ngrok 和 Jupyteer Lab 的读写访问权限
问题描述
我想通过使用 ngrok 转发 8888 本地托管的 Jupyter Lab 来与一位值得信赖的朋友举行一次编码派对。但是我的朋友可以看到这些文件,但他们没有读写权限。我怎样才能解决这个问题?
我在这里阅读了这篇文章:https ://towardsdatascience.com/how-to-collaborate-on-your-locally-hosted-jupyter-notebook-28e0dcd8aeca
但基本上,它根本没有提到需要证书。那么我能做什么呢?
以下是无法查看该网站的用户的说明文本:
Installing Ngrok
Setting up Ngrok consist of 3 simple steps:
1. Sign Up*
You can easily make a free account by clicking on “Sign Up”. Just fill in your credentials and you’re fired up — Link to sign up page here: https://ngrok.com/product
2. Download
Download Ngrok that is suitable for your operating system then Unzip it once it’s downloaded.
Note: On Linux or Mac OS X you can unzip ngrok from a terminal with the following command. On Windows, just double click ngrok.zip to extract it.
3. Connect your Account
The next step is simply authenticating your Ngrok agent, which only needs to be done once as the Authtoken is saved in the default configuration file.
Your authentication token can be accessed by going to Authentication on the side bar then Your Authtoken — See image below.
I prefer the command line set up which includes simply telling Ngrok your authentication token.
./ngrok authtoken 1g3Zd5XeTdmRTYIvOZmGVBW3hAH_2873ypJDaDf6ybyUzmSUj
Great! You are now all set up, but now you must learn to share your Jupyter Notebook.
Sharing the Notebook
For Jupyter Notebooks to be accessed remotely we must make some adjustments to our Jupyter Notebook configuration, and for extra security, we will add a password.
jupyter notebook --generate-config
This will return the link address to the configuration file of your Jupyter Notebook.
Writing default config to: C:\Users\Kurtis\.jupyter\jupyter_notebook_config.py
Copy the link address and run the following command
echo "NotebookApp.allow_remote_access = True" >> C:\Users\Kurtis\.jupyter\jupyter_notebook_config.py
Then we add a password…
jupyter notebook password
We now have everything required to run and connect our Jupyter Notebook so that it could be shared remotely.
Tip: In the next part we’ll need two separate terminals connected to our remote because once we run jupyter, it will occupy a window with logging. You can either open a second terminal and ssh into it again, or you can use a tool like tmux to manage them within a single terminal. (Source: ArtificialSoph Github)
https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/
https://gist.github.com/artificialsoph/443a8bf9af3302df9cb0cb54a616f838
Open your Jupyter Notebook by typing jupyter notebook in your terminal.
jupyter notebook
After we’ve accessed our Jupyter Notebook we tell Ngrok what port our web server is listening on.
The above image highlights the port. Thence we would tell Ngrok the port is 8888.
ngrok http [port] -host-header="localhost:[port]"
Your results should look like the one displayed below
Copy the forwarding address and share it with whoever you want to collaborate with — if you followed our steps and set up a password then you’ll have to tell them the password.
Great, now you can collaborate!
谢谢!
解决方案
推荐阅读
- pyspark - 如何通过 Pyspark 中同一数据框中另一列的正则表达式值过滤数据框中的一列
- powershell - PowerShell,查找重复文件夹的更有效方法
- json - 在 TypeScript 中获取 JSON 数组的最后一个元素
- sql - sql在多本书中查找多个字符
- laravel - 控制器返回 `false` 而 DashboardController 返回 `true`
- powershell - 我的 Powershell 脚本现在返回空值表达式错误是否有原因?
- swift - Swift - 类型等于协议的变量
- jax-rs - CDI 注入无法在 WAS Liberty 的 REST 资源中使用 Jersey 作为 JAX-RS 实现
- sql-server - 记录按字段名称计数。动态 SQL
- sql - MS Access:查询需要很长时间才能运行