Centos – Moodle installation issue

centos-7permissions

I am trying to install moodle onto my web sever, but it can't create the moodle data directory, because of missing write permissions:

Parent directory (/var/www) is not writeable. Data directory (/var/www/moodledata) cannot be created by the installer.
I have tried to set chmod 777 & 666 to the www directory, but it still doesn't work…

ls -al result:

drwxrwsrwx+  4 apache apache   31 Dec  8 15:49 www

Edit:

My permissions for the www folder are just ultimately messed up, because i don't understand a thing about permissions could someone help me fix them up? I need to also allow sftp_users group to access the files:

ls -al on www:

drwxrwsrwx+  5 apache sftp_users   48 Dec  8 19:35 www

ls -al inside www:

drwxrwsrwx+  5 apache sftp_users   48 Dec  8 19:35 .
drwxr-xr-x. 22 root   root       4096 Dec  8 17:29 ..
drwxrwx---.  2 root   sftp_users    6 Aug 24 21:12 cgi-bin
drwxrws---+  3 root   sftp_users   35 Dec  8 19:36 html
drwxrwsr-x+  2 root   sftp_users    6 Dec  8 19:35 moodledata

Best Answer

It could be that selinux is blocking access. Check it with command getenforce. If the result is Enforce, then you may want to change it to Permissive, with command setenforce 0 or setenforce Permissive. You can also disable selinux by editing /etc/selinux/config and setting SELINUX = disabled. Reboot would be required in that case. Also - is the directory ./moodledata a www directory for moodle or is it directory for file storage? If the second case, best is to move it outside the www directory, a designated directory in / like /moodledata and then set permissions on that directory for apache (or put this folder on separate disk or SAN share or NFS).

Related Question