# Restrict Users to their notebook directory upon logging into JupyterHub

**URL:** https://discourse.jupyter.org/t/restrict-users-to-their-notebook-directory-upon-logging-into-jupyterhub/28590
**Category:** JupyterHub
**Created:** [September 23, 2024, 10:36am UTC](https://discourse.jupyter.org/t/restrict-users-to-their-notebook-directory-upon-logging-into-jupyterhub/28590 "2024-09-23T10:36:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![shakthi](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@shakthi](https://discourse.jupyter.org/u/shakthi)
#### Post date: [September 23, 2024, 10:36am UTC](https://discourse.jupyter.org/t/restrict-users-to-their-notebook-directory-upon-logging-into-jupyterhub/28590/1 "2024-09-23T10:36:48Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)
#### Post date: [September 23, 2024, 1:16pm UTC](https://discourse.jupyter.org/t/restrict-users-to-their-notebook-directory-upon-logging-into-jupyterhub/28590/2 "2024-09-23T13:16:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![shakthi](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@shakthi](https://discourse.jupyter.org/u/shakthi)
#### Post date: [September 24, 2024, 8:10am UTC](https://discourse.jupyter.org/t/restrict-users-to-their-notebook-directory-upon-logging-into-jupyterhub/28590/3 "2024-09-24T08:10:18Z")

</div>

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 .

---

<div class="post-metadata">

### Author: ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)
#### Post date: [September 24, 2024, 3:18pm UTC](https://discourse.jupyter.org/t/restrict-users-to-their-notebook-directory-upon-logging-into-jupyterhub/28590/4 "2024-09-24T15:18:35Z")

</div>

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.
