Closed martinzugnoni closed 6 years ago
I found the solution.
There's a JUPYTERHUB_USER
env var that contains the username of the authenticated JupyterHub user. I can use that for the prefix name, like this:
import os
c.S3ContentsManager.prefix = '{username}'.format(username=os.environ['JUPYTERHUB_USER'])
Thanks!
@martinzugnoni I'm trying to achieve the exactly same thing, using DockerSpawner and Github OAuth. I'm able to use the DockerSpawner and GithubOAuth with Jupyterhub Deploy Docker but while trying to use the S3contents with the above architecture, it didn't work for me. Could you please share your jupyterhub_config.py
or point me to the repository for the thing that you have done in the past. This would help me a lot in my current project. Any help would be appreciated.
Thanks!
I'm using JupyterHub with the DockerSpawner and Github OAuth configuration. When a user authenticates using Github, a new container is created using the
jupyterhub/singleuser
image. Despite having a separated container per authenticated user, everything inside each container runs under the samejovyan
username.I tried to keep users' files and folders in S3 separated by user namespaces, using this configuration:
But, of course, all prefixes get the
jovyan
username.Is there any way of defining a prefix inside each container based on the real authenticated user instead of the user running the container?
My final goal is to have files/folders in S3 separated in users namespaces, so each of them can have their own files and there are no conflicts.