Commit b4d2d6f5 authored by Christian Mesh's avatar Christian Mesh Committed by GitHub

Support provisioned storage with incorrect permissions

I ran into an issue when trying to get this to work with a NFS server which I did not have direct control over (EFS).  As part of the PersistentVolumeClaim, there is no easy way to set the UID and GID of the created directory.on the networked FS.

My only concern with this chown is that some user out there might be running jupyterhub in an odd configuration where $NB_USER is not supposed to have these exact permissions on the storage.  I think this is quite unlikely, but it is worth mentioning. 

I chronicled my experiences with working around this issue and setting up z2jh on EFS in https://github.com/jupyterhub/zero-to-jupyterhub-k8s/issues/421 with @yuvipanda.
parent 27ba5736
...@@ -17,6 +17,10 @@ if [ $(id -u) == 0 ] ; then ...@@ -17,6 +17,10 @@ if [ $(id -u) == 0 ] ; then
# Handle username change. Since this is cheap, do this unconditionally # Handle username change. Since this is cheap, do this unconditionally
echo "Set username to: $NB_USER" echo "Set username to: $NB_USER"
usermod -d /home/$NB_USER -l $NB_USER jovyan usermod -d /home/$NB_USER -l $NB_USER jovyan
# Handle case where provisioned storage does not have the correct permissions by default
# Ex: default NFS/EFS (no auto-uid/gid)
chown $NB_UID:$NB_GID /home/$NB_USER
# handle home and working directory if the username changed # handle home and working directory if the username changed
if [[ "$NB_USER" != "jovyan" ]]; then if [[ "$NB_USER" != "jovyan" ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment