Suddenly getting permission denied error when restoring courses

Suddenly getting permission denied error when restoring courses

by Troy Shimkus -
Number of replies: 3

We've suddently been getting errors when trying to restore a course, we get all the way throught he process and the last step failes with:

Can not read file, either file does not exist or there are permission problems

Pointing to: http://docs.moodle.org/22/en/error/moodle/storedfilecannotread

Debugging returns:

Output buffer: Warning: copy(/home/moodledata/filedir/38/db/38db0fd979b2de2ab9369a883c6e1b4ac97ab6d9): failed to open stream: Permission denied in /var/www/html/lib/filestorage/file_storage.php on line 1132

I don't really know what would have caused this issue all of a sudden. To my knowledge nothing has been changed on the server.

Our existing moodledata folder has the following permissions:

drwxrws---  9 root   apache 4.0K Jan 18 04:30 moodledata
Folders inside moodledata are as:

drwxrwx---   7 root apache 4.0K Dec  5 10:56 cache
drwxrwx--- 258 root apache 4.0K Aug  6 14:20 filedir
drwxrwx---   4 root apache 4.0K Sep 22 10:13 filter
drwxrwx---   2 root apache 4.0K Aug  6 14:20 lang
drwxrwx---   3 root apache 4.0K Aug  6 14:20 repository
drwxrwx---  12 root apache 4.0K Sep  6 14:21 temp
drwxrws---  43 root apache 4.0K Jan 18 15:15 trashdir

The backup files are held in the repository/backups/to-restore folder which is an FTP repository that allows the manager to uplaod zip files

The file we are restoring is:

-rwxrwx--- 1 apache apache  30M Jan 18 09:47 CourseBackup1.zip

Any help tracing where the permission problem is coming from would be great.

Average of ratings: -
In reply to Troy Shimkus

Re: Suddenly getting permission denied error when restoring courses

by Troy Shimkus -

So, just realzied that if I make a blank course, and restore the backup file into the course, it works fine.

Doesn't really help me find the problem yet - but at least we have a work around for now.

In reply to Troy Shimkus

Re: Suddenly getting permission denied error when restoring courses

by Frederic Nevers -

I've had a similar issue when using 'zip' in PHP but never using Moodle. Turns out it was to do with folders being owned by root:apache instead of apache:apache

I would suggest you try changing the ownership and see whether that makes a difference. 

Cheers 

 Fred

In reply to Frederic Nevers

Re: Suddenly getting permission denied error when restoring courses

by Troy Shimkus -

That is the direction I was leaning, I attemtped to change ownership of one of the folders that the debug message refrerenced, but nothing changed, same error.

I'm a little leery of chaning the ownership setup on the server as a whole in the middle of a semester, it's a mission crticial system, and I can't afford to bring it down if anything goes wrong.

I might try to do a backup of the system to a seperate server and see how that goes though.

THanks.