Jupyter支持多用户

anaconda自带了jupyter,平时调试代码还是很好用的,但是没有多用户,资源共享不方便。JupyterHub是一个多用户Hub,提供了多用户服务,先上官网地址,更多详情配置请看官方介绍。

1、安装py环境anaconda。

2、安装jupyterhub: conda install -c conda-forge jupyterhub。pip安装方法参考这里

3、生成配置文件:在配置文件目录下执行 jupyterhub --generate-config,建议放在 /etc/jupyterhub目录下面

3、启动jupyterhub:jupyterhub -f /etc/jupyterhub/jupyterhub_config.py,默认8000端口,也可以通过nohup在后台启动。

4、多用户:在Linux下添加新用户并设置密码,以新用户名和密码登录jupyterhub即可。
5、网上常用方法是设置 c.Authenticator.whitelist 添加白名单,但是jupyterhub对centos添加新用户的命令支持不好,出错,并且它的底层依然是添加linux新用户。另一种方法是在配置文件中自定义 c.Authenticator.add_user_cmd 配置,例如:

c.LocalAuthenticator.add_user_cmd = ['adduser', '-m', '-G', 'jupyterhub-users'] ,此时添加白名单方法生效。

猜你喜欢

转载自blog.csdn.net/haveanybody/article/details/84030457
今日推荐