Jupyter/iPython Notebook的根访问权限 [英] Root access for Jupyter/iPython Notebook
问题描述
我正在尝试在iPython/Jupyter笔记本中使用bash内核,但是我需要在笔记本本身内部进行sudo访问.
I'm trying to use the bash kernel in iPython/Jupyter notebook, but I need sudo access within the notebook itself.
我已经尝试过$ sudo jupyter notebook
以root身份运行笔记本,但这只会返回:
I've tried $ sudo jupyter notebook
to run the notebook as root, but that only returns:
$ jupyter: 'notebook' is not a Jupyter command
所以,我只剩下运行$ jupyter notebook
(除非有一种方法可以以root身份运行Jupyter Notebook).
So, I'm left with running $ jupyter notebook
(unless there's a way to run Jupyter notebook as root).
我也不能在笔记本本身中执行su root
,因为这需要输入,并且笔记本不会让我输入.
I also can't do su root
in the notebook itself because that requires an input and the notebook won't let me give an input.
最后,据称Jupyter笔记本有一个--allow-root
选项:
http://jupyter-notebook.readthedocs.io/en/latest/config.html
Finally, there is allegedly an --allow-root
option for Jupyter notebook:
http://jupyter-notebook.readthedocs.io/en/latest/config.html
但是,看起来--allow_root
不再是一个选项. (我已经尝试通过添加NotebookApp.allow_root=True
来修改配置文件,但这是行不通的.)
However, it looks like --allow_root
is no longer an option. (I've tried modifying the config file by adding NotebookApp.allow_root=True
, but that doesn't work.)
有创意的人吗?也许我做错了什么?
Any ideas guys? Maybe I'm doing something wrong?
推荐答案
从根配置文件添加c.NotebookApp.allow_root=True
.不需要每次都问allow-root
然后启动笔记本电脑.
Add c.NotebookApp.allow_root=True
from the root configuration files. That you don't need ask to allow-root
every time then you start the notebook.
在编辑配置文件之前,您需要以root用户身份运行jupyter notebook --generate-config
来制作该文件.
Before edit the configuration file you need to run jupyter notebook --generate-config
as root to make the file.
这篇关于Jupyter/iPython Notebook的根访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!