Cannot enter datadir despite file permissions

Nextcloud version : 21
Operating system and version: Debian 10

The issue you are facing:
Nextcloud cannot enter the datadir despite user permissions.

drwxrwx--- 7 nextcloud nextcloud 328 Jul 18 22:48 ncdata
drwxrwx--- 6 nextcloud nextcloud 504 Jul 18 22:42 ncdata2
# sudo -u nextcloud ls ncdata2
ls: cannot access 'ncdata2': Permission denied

But the same on ncdata does work:

# sudo -u nextcloud ls -hal  ncdata
total 909K
drwxrwx---  7 nextcloud nextcloud  328 Jul 18 22:48 .
drwxrwx---  6 nextcloud nextcloud  208 Jul 18 22:43 ..
drwxrwx--- 13 nextcloud nextcloud    0 May 16 21:23 appdata_ocgzg0czgj3f
drwxrwx---  2 nextcloud nextcloud    0 May 15 14:15 files_external

What can possibly be wrong with the file permissions?

Hi @whatsnext, have you checked if the parent folder of ncdata2 allows nextcloud ( the user) to have read permissions?

it does. Also, there is another dir next to this one with the same nextcloud user permissions that can be accessed and written to.

Difference is, I used gocryptfs to mount the data-dir. Nonetheless, this was not a problem before, it became a problem overnight. Also, I wouldn’t know what to change. It has the proper permissions it seems, yet it ‘pretends’ not to have those.

@whatsnext ok , this is really strange …
can you connect into nextcloud user and check if you see your folder ?

Not sure what you mean. I cannot connect to my nextcloud web-interface (neither any client). I can browse the server with ssh, the folder is there, everything is there, all data, etc. I removed and re-added .ocdata with root and changed ownership to nextcloud:nextcloud again, rebooted, etc. It did not work. It is things like
sudo -u nextcloud ls that do not work.

@whatsnext ok, try to change it by www-data user maybe there is an issue with nextcloud user

you are on nextcloud pi ?

I am on debian 10 with Yunohost on a vps. I tried by adding user www-data to the group nextcloud, that did not work. Since I am now in the process of backing up 200GB (very slow…) from that ncdata2 directory I cannot change the permissions recursively.

What would be the logic by changing it? It used to work, it is supposed to work with user nextcloud like this.

@whatsnext it depends on the type of installation you are using, if you are using something other than nextcloud pi or a manual installation, the change will do nothing
but if this is the case the nextcloud user should belong to the group www-data however it may not be there.