jupyterhub中的共享可写文件夹 [英] Shared, writable folders in jupyterhub

查看:1062
本文介绍了jupyterhub中的共享可写文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在docker容器中构建jupyterhub环境,并在共享文件夹中苦苦挣扎.我们的目标是设置一个对所有用户都可写的共享文件夹.

We are currently building a jupyterhub environment in a docker container and struggling with shared folders. Our goal is to set up a shared folder wich is writable for all users.

在每个用户的主文件夹中,有一个符号链接~/shared/opt/shared.目标文件夹具有权限777,并由组 jupyter 拥有.每个用户都是 jupyter 组的成员.但是,如果一个用户在使用他的帐户登录到Web应用程序的共享文件夹中创建文件,则权限设置为644.因此,没有其他用户可以编辑该文件.

In each user's home folder there is a symbolic link ~/shared to /opt/shared. The target folder has the permissions 777 and is owned by the group jupyter. Each user is member of the group jupyter. However, if one user creates a file in the shared folder logged in with his account into the web app, the permissions are set to 644. Therefore, no other user can edit the file.

我尝试为每个用户在/etc/profiles~/.bashrc文件中将umask设置为000.但是,jupyter似乎忽略了它.是否可以将jupyter配置为默认创建具有g+w权限的新文件?我想避免在文件系统级别用setfacl设置访问控制列表,因为它需要/etc/fstab中的自定义标志.

I've tried to set the umask to 000 in the /etc/profiles and the ~/.bashrc files for each user. However, jupyter seems to ignore it. Is there a possibility to configure jupyter to create new files with g+w rights as default? I would like to avoid setting up access control lists with setfacl at the file system level because it requires custom flags in the /etc/fstab.

推荐答案

  1. 设置一个组(即您的案例中的jupyter)到共享文件夹chgrp jupyter /opt/shared
  2. 允许该组写入该目录+使该组具有粘性(使用该组而不是用户的主要组创建新文件)chmod g+ws /opt/shared
  3. 为每个用户创建~/.jupyter/jupyter_notebook_config.py
  1. Set a group (i.e., jupyter in your case) to shared folder chgrp jupyter /opt/shared
  2. Allow the group to write to that directory + make group sticky (new files are created with this group instead of user's primary group) chmod g+ws /opt/shared
  3. For each user create ~/.jupyter/jupyter_notebook_config.py

具有以下内容:

  import os
  os.umask(0o002)

新创建的文件将可由该组写入.

Newly created files will be writable by the group.

这篇关于jupyterhub中的共享可写文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆