jupyterhub / systemdspawner

Spawn JupyterHub single-user notebook servers with systemd
BSD 3-Clause "New" or "Revised" License
92 stars 45 forks source link

no way to define non-standard home directories #30

Closed cpainterwakefield closed 6 years ago

cpainterwakefield commented 6 years ago

Hi, I'm using jupyterhub with systemdspawner on a linux system where the home directories are mounted using some scheme that I have no control over and don't really understand (I have sudo privileges, but don't administer things like users). The home directories for the users are not /home/{USERNAME}, and they are not all under the same parent directory. E.g., my home directory is under /u/af/ci/{USERNAME}, but others are under /u/xx/yy/{USERNAME}, substitute whatever two letter string for xx and yy.

For now, I hacked the systemdspawner.py code to add an additional alias {USERHOME}, which is looked up via os.path.expanduser('~' + self.user.name)

I know this is a horrible hack, but I don't know what else to do short term. What is a better long term fix? Can systemdspawner be modified to lookup user home directories as the default, instead of hardcoding as /home/{USERNAME}?

Thank you.

dbuse commented 6 years ago

Hi, we had the same issue and worked around it by simply symlinking all homes to /home/{username}. Althogh a replacement makro for something resolving to $HOME or ~{username} would be both nice and possible. Best.

cpainterwakefield commented 6 years ago

OK, when I have time I guess I'll put together a PR. The symlink thing is impractical for me.

yuvipanda commented 6 years ago

Apologies for the delayed response! #34 makes homes default to whatever is in the password database, which should 'do the right thing'. I'll merge it shortly and make a new release!