Restrict Users to their notebook directory upon logging into JupyterHub

Currently, in JupyterHub, users have access to all folders and files. However, I would like to restrict them to their individual notebook directories only, ensuring they are unable to access or view any other files or directories. Could you please suggest possible solutions to achieve this?

As additional information, we are running JupyterHub 4.0.5 in a Kubernetes environment where single-user pods (jupyterLab) are created whenever a user logs in.

I don’t think that’s possible- JupyterLab and Python require access to system libraries to run. If you can explain why you need to restrict access we might be able to suggest another solution.

Thank you for the confirmation @manics . I was thinking access to sensitive directories, users might accidentally modify some critical system files or run some scripts which might destabilize the environment .

Since you’re using Kubernetes each user should have their own container, so in the worst case they’ll only break their own workspace. You can use normal unix owner/group permissions on files and directories to restrict what users can modify, and you can also add Kubernetes resource limits to restrict memory and CPU usage.

1 Like