General developer forum

directory permissions

 
Picture of D Riddel
directory permissions
 

Hi, I'm getting an error message "invalid permissions detected when trying to create a directory. Turn debugging on for further details."

Originally, the permissions/ownership for both moodle files and moodledata folder are set to how Moodle recommends (https://docs.moodle.org/34/en/Security_recommendations). So getting this error is already strange. 

Here's what I did:

1. Ownership of moodledata/temp folder was apache for some reason. /Changed it to root and It works again. But one week later, the error returns!

2. Changed the entire moodledata/temp folder to 777. And it works again. However, one week after that the error returns!

3. I'm on the third week. I changed the entire moodledata folder to 777. It works again now.


But this shouldn't be happening in the first place. I shouldn't have to have moodledata at 777. I definitely am required to change this for security reasons.

Has anyone had this problem? Is there something in moodle that changes permission requirements?

Much appreciated. Regards.

David

 
Average of ratings: -
Picture of Darko Miletić
Re: directory permissions
Core developersParticularly helpful Moodlers

I guess you are a bit confused. As stated in the document you shared moodledata MUST be owned by user/group under which your web server operates. moodledata/temp is regularly deleted and recreated by Moodle itself.

See again:

https://docs.moodle.org/34/en/Security_recommendations#Running_Moodle_on_a_dedicated_server

The issue probably comes from running moodle cron under user root. You should run moodle cron using the web server user/group to avoid conflicts.

 
Average of ratings: -
Picture of D Riddel
Re: directory permissions
 

Hey, thanks for the tip! It works!

Previously, it wasn't working with root:root on moodle folders with even 775 on moodledata folders. So, I changed my moodle folders to root:apache and changed all moodledata folders back to 755, and it works!

Hopefully it lasts!

Much appreciated.

 
Average of ratings: -