jupyterhub / jupyterhub-deploy-docker

Reference deployment of JupyterHub with docker
BSD 3-Clause "New" or "Revised" License
701 stars 367 forks source link

Persist home user ssh keys into volume #113

Closed priamai closed 1 year ago

priamai commented 2 years ago

Proposed change

When user creates their own ssh keys to interact with gitlab they will be stored in the home .ssh hidden folder. I don't want the user to regenerate their ssh keys every time we restart the docker so I attempted this:

c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir,'ssh-home-{username}':{'bind':'/home/jovyan/.ssh','mode':'ro'} }

However when I try to generate the keys:

(base) jovyan@c7a123167863:~$ ssh-keygen -t rsa -C "test"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jovyan/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Saving key "/home/jovyan/.ssh/id_rsa" failed: Permission denied

I am not sure how should I set the permissions on the docker volume or elsewhere?

meeseeksmachine commented 2 years ago

This issue has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/permission-denied-on-ssh-keys/13107/1

manics commented 1 year ago

This was cross-posted to https://discourse.jupyter.org/t/permission-denied-on-ssh-keys/13107/3 The problem was resolved though no answer was given.