Is there a way to set the root directory in `JupyterHub`?

I am using the base-notebook image as a Spawner, and I cannot figure out how to set the baseDir to limit the user to access to the specified folder (I’m using the jupyter kernel evcxr, and I uninstalled the kernel ipykernel and forbidden opening terminal in jupyter, so the only thing I need to do is to set the root directory). Anyone can help me?

JupyterHub is a server for managing singleuser/notebook servers for multiple users. Since you’re juts using the base-notebook container image you can ignore JupyterHub completely.

There’s a Jupyter server configuration option ServerApp.root_dir that I think may work for you

Though note that won’t stop the kernel from accessing files outside that directory- it just means it’s not accessible via the UI.

1 Like

Thanks for your help, I tested the method you mentioned above. As you said, the kernel can still access the files outside the root directory. I thought I should find another way to do it like inserting an expression os::unix::chroot("current_dir") ahead of each evaluation.