### dataroot is not writable, admin has to fix directory permissions

Re: Data directory cannot be created by installer(c:/inetpub/wwwroot/moodledata)

Today I ran into the same error.

After a while i got the idea.

On any linux box such as Red Hat, Cent OS, fedora and Co there is a pretty good likelihood that SELinux is enabled and enforced.

First of all you should check the directory and file permissions. Being at least accessible and readable to the web server - most often apache. Dirs and files should be owned by apache:apache.

The SELinux  is quite consequent. I therefore  ran into this issue after relabelling the system.

In case that after permission setting the web server still does complain about

„$CFG->dataroot not writable“ look at the SELinux labels of the dirs and files in$CFG->dataroot.

They are displayed with the CLI

ls -lZ /full_path_of_dataroot

All labels should be

apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0  4096  1. Dez 14:21 cache
The httpd_sys_rw_content shows that the dir or file is writeable.

In case this is not given execute

sudo chcon -R -t httpd_sys_rw_content_t /full_path_of_dataroot
This will change the file context recursively to the type httpd read/write.