Hello everyone. I am getting the error Error Your data directory is not writable. Permissions can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/29/go.php?to=admin-dir_permissions. error.
I followed the tutorial found here However I am using Fedora Server 40 instead of CentOS. I got pretty far with everything but I think I’m encountering a bug. (I also used the latest.zip instead of the zip provided in the tutorial)
As you can see, my permissions are set correctly, I have tested setting the permissions with sudo chmod -R 777 /var/www/html/nextcloud and then navigating to the data directory, and doing a touch test.txt and the directory is definitely writable. I then tried leaving it with those permissions, restarting everything, and still NextCloud is stating that the data directory is not writable.
I did use the occ file to set up the installation as the web installer was not letting me continue as it was giving the same error that the data directory was not writable. But the occ installer worked just fine. It clearly created the files in the data directory without issue. But for some reason it’s still giving the error. I’m kind of at a loss here and I’m tired of ripping out my hair with this. Any help would be greatly appreciated.
I am not an expert when it comes to running server applications on Fedora, but I noticed that there is a dot (.) after the permissions in your file listings, indicating that SELinux is enabled, which is probably the cause of your problem and needs to be configured accordingly… SELinux configuration — Nextcloud latest Administration Manual latest documentation
Yes, SELinux was the issue, but the tutorial I followed should have set the SELinux permissions properly. I got some help from the Fedora discord and it turns out I needed to run these three commands in order:
Then when I restarted httpd everything seemed to work. I’m not sure why the commands in the tutorial did not work as they should. But the last command as you can see uses the -m flag instead of the -a flag.
I’m not sure either, since I’m not familiar with SELinux at all. But feel free to open an issue, or edit the documentation yourself and create a pull request, if you think it’s incorrect or if something needs to be added: GitHub - nextcloud/documentation: 📘 Nextcloud documentation
“-a” adds a new record. “-m” modifies an existing record. My guess is that the httpd user has to modify existing files in the data directory, but can’t unless it has the “modify” selinux context on the file.