Notebook landing directory vs Root folder

Hi all,

I’m trying to understand some of the nuances of the directory structure. I would like to build a jupyterhub where users by default start in their home directory, but still have access to the root of the file system.

From what I understand, this can be at least partially controlled via:

c.NotebookApp.notebook_dir

Maybe someone can give me some hints?
Thanks
Paul

The ‘root’ directory of the server is ServerApp.root_dir, the default URL is ServerApp.default_url.

In JupyterHub, the root directory can be set via Spawner.notebook_dir and the starting URL with Spawner.default_url, which will replace the string {username} with the user’s name, e.g.

# jupyterhub_config.py
c.Spawner.notebook_dir = "/home/"
c.Spawner.default_url = "/lab/tree/{username}/"

which means the server will serve everything in /home/, but on first visit, users will see the view of /home/theirname/ in jupyterlab.

Hi @minrk,

thanks, this almost solves my problem. I get the following:

pgierz in 🌐 albedo0 in jupyterhub-3.1.1 on  master [!?] via 🐍 v3.10.6
❯ grep "c.Spawner.notebook_dir" opt/jupyterhub/test_jupyterhub_config.py
c.Spawner.notebook_dir = '/'

pgierz in 🌐 albedo0 in jupyterhub-3.1.1 on  master [!?] via 🐍 v3.10.6
❯ grep "c.Spawner.default_url" opt/jupyterhub/test_jupyterhub_config.py
c.Spawner.default_url = "/lab/tree/{username}/"

That gives me a “unknown user” popup, which I can just click away, but dumps me into / directly. Unfortunately, our system does not follow a default Linux idea of /home/{username} but instead prepends it to /albedo/home/{username} (albedo is the name of our machine)

What comes after /lab/tree should be the path relative to notebook_dir, so /lab/tree/albedo/home/{username} should work, if I’ve understood your setup correctly.