Can create files but not folders

Hi all,
I used NC for some time, but after some hardware modifications and data migration, I used some time to get NC up and running from Scratch.
I installed a docker version of NC with a mariaDB database hosted in another VM. Everything went fine, I am able to upload files and stuff until I wanted ot create folders ! Anytime I wanted to create a folder for a user, I get the “Unable to create folder” error.

I am able to upload files directly inside NC and it’s working fine, checking data in the shared folder is OK. But I am unable to create folders, only files. It soundsweird for me because I had a lot of problems with Unix rights and Docker, also with NC and other containers. But I don’t understand why beeing able to upload files is not the same as creating folders !

NC version : 22.2.5 in fresh installation

braking the issue into easier operations might help you to understand and fix the issue. Maybe you start with a shell inside of the docker container and try to create a folder as www-data user there - depending on the result you might see a meaninful error or proof that folder can be created on “OS level”

#docker exec -ti --user www-data <name of your container> /bin/bash
docker exec -ti --user www-data nextcloud /bin/bash
# default data location
cd /var/www/html/data
mkdir <name of new folder>

once you are there double check the rights of the /data folder, in my case its 750 www-data www-data for the drirectory itself and 755 www-data www-data for each user directory…

www-data@c55621a3a2cd:~/html/data$ ls -al /var/www/html/data
total 8480
drwxr-x--- 10 www-data www-data       15 Dec 30 22:45 .
...
drwxr-xr-x  5 www-data www-data        5 Sep 15 20:55 test3
drwxr-xr-x  5 www-data www-data        5 Sep 15 20:50 test4
drwxr-xr-x  4 www-data www-data        4 Sep 15 20:54 test5

I tested with the exec in root and su afterwards, but following the exact same command as yours leads me to also have 750 1500:2000 on data folder and 755 1500:2000 on the created folder.
( But it’s ok because I’ve launched the NC docker container as user 1500:2000 not to interfere with the NFS sharing data are written to.)

So this results seems fine and aligned with what you have on your working version.

I’ve tested to create a file with the UI and not upload it or whatsoever, but creating a .md file directly from the UI seems to work also. It seems only folders are affected.

until I get the docker completely wrong you should see 33:33 inside the container which maps to 1500:200 outside = in the host. try checking the ID of the user www-data inside of the container (apache user)

So after long investigations, I finally found what causes the folders to not beeing created.
I manage my linux shares via NFS and for some shares specific services I squash all users to 1500:2000, so in this way I’m sure not to have privilege escalation. But in fact, Nextcloud even if the folder seems created with the correct UserId:GroupID may want to chown the folder to the right rights even if they are already met, and in this case the squash failed …
So the only solution for me was to disable all users squash specifically for NC, not the best solution for me but at least it works like a charm !

PS : I’ve tried this solution with or without the user tag in docker compose, and managing the rights with the www-data user or the 1500:2000 user/group.

1 Like