# JupyterHub SwarmSpawner with NFS persisent storage - is this expected to work?

**URL:** <https://discourse.jupyter.org/t/jupyterhub-swarmspawner-with-nfs-persisent-storage-is-this-expected-to-work/9741>\
**Category:** JupyterHub\
**Tags:** how-to, help-wanted\
**Created:** [June 24, 2021, 3:37pm UTC](https://discourse.jupyter.org/t/jupyterhub-swarmspawner-with-nfs-persisent-storage-is-this-expected-to-work/9741 "2021-06-24T15:37:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davehatton](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/davehatton/32/4669_2.png) [@davehatton](https://discourse.jupyter.org/u/davehatton)\
**Post date:** [June 24, 2021, 3:37pm UTC](https://discourse.jupyter.org/t/jupyterhub-swarmspawner-with-nfs-persisent-storage-is-this-expected-to-work/9741/1 "2021-06-24T15:37:11Z")

</div>

I have deployed JupyterHub to docker-swarm using swarmspawner.  
I have also configured LDAP/AD authentication and I have the users NFS home directory mounted to the host VM and shared to the notebook container via a bind mount.

So far so good … but now Jupyter cannot write to the mounted directory /home/joyvan/work.

This is expected since in the container Jupyter is running as user joyvan (uid=1000, gid=100) but the storage has the uid/gid of the external AD user.

I’ve searched a lot but not found an answer to this. This maybe poor searching on my side!

My question(s)

- is it expected that persistent storage via bind mounts to the docker container is expected to work?
- if so … how would I map the external uid/gid to the joyvan uid/gid?
- any alternative suggestions as to how to NFS persistent storage with docker based Jupyter notebooks?

Any help or pointers gratefully received!

---

<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:** [June 25, 2021, 4:04pm UTC](https://discourse.jupyter.org/t/jupyterhub-swarmspawner-with-nfs-persisent-storage-is-this-expected-to-work/9741/2 "2021-06-25T16:04:36Z")

</div>

You should be able to run your Jupyter singleuser server as the correct UID, you can even switch the username to match. For example see

> [@KubeSpawner and LDAPauthentication run under users LDAP UID](https://discourse.jupyter.org/t/kubespawner-and-ldapauthentication-run-under-users-ldap-uid/8988):
>
> Hello, I’m using LDAP authentication to authenticate users for our Jupyterhub running in Kubernetes (using z2jh helm chart). Currently, I’m trying to get the singleuser servers to run as the user, with the proper UID and GID provided from LDAP. I can set that up just fine using auth\_state\_attributes and can pull that in through extraConfig to set NB\_USER, NB\_UID, NB\_GID but am still running into issues getting the singleuser server to run with those respectively. I’ve tried following the solu…

> [@Starting single-user notebook with our custom ldap docker image](https://discourse.jupyter.org/t/starting-single-user-notebook-with-our-custom-ldap-docker-image/881/4):
>
> I’ve done this before. It requires [this change to the LDAPAuthenticator](https://github.com/jupyterhub/ldapauthenticator/pull/103). You can then configure JupyterHub to extract the required LDAP attributes (username, UID), and pass them to the singleuser server by setting appropriate environment variables. If you start the singleuser server as root it will switch to that UID, which means it should be able to write to NFS as that user. I’ve written up some brief instructions:
