Cannot save notebook ("Permission denied")

Hi, I cannot save some of my notebooks in JupyterHub. I get error “Permission denied”. The strangest thing is that if I open the notebook in nano, I can save the notebook seamlessly. This is probably caused by some permissions scripts that I run which change permissions for this file too. But even after I presumably make this file open and see its permissions as follows: -rw-rw-rw-, I still get error in JupyterHub as I try to save it. Both in nano and Jupyterhub I open the file under the same username, so it freaks me out. The workaround that I’ve found so far is to save the file as different file, then delete the original and rename the second file into original one. But I want to understand what causes this strange behavior and how to fix it.

Hi, this is unlikely to be a problem with JupyterHub, as you’ve realised it’s most likely to do with your file system permissions. Jupyter Notebook/lab may create additional files/directories (e.g. checkpoint files), could that be the problem? Can you paste the output of

ls -lRa

in your working directory?

If this doesn’t help please give us as much information as possible about your system and JupyterHub deployment, and details of how you set or changed the permissions. Ideally provide enough information so someone could reproduce your problem if they wanted to.

Add yourself to the root group: sudo usermod -aG root username