Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Permissions on Uploaded Files.


Reply


3 Posts   1736 Views

Avatar
Patrick Arlt

Community Member, 15 Posts

20 March 2010 at 2:09pm

I am using Silverstripe on my universities web-server for a class website and I have run into a small hitch.

Whenever I upload a file using the CMS the file is uploaded with read only permissions (600) which means that it will not display on pages, ect...

I have emailed the schools tech department about this and am waiting for a response and thought I would post here also.

The files will upload successfully to the server and the assets folder and all its sub-folders have 777 as there permissions.

Is this a Silverstripe issue or a server issue? I have read around these forums a little and some of the suggestions are to write a cron job that would change all the permissions in everything in the assets folder to 755 every so often or to decorate the File class to change the permissions after upload. Could anyone shed light on either of those methods and give me some link to relevant documentation ect...

Avatar
BigChris

Community Member, 63 Posts

21 March 2010 at 12:24am

Hi Patrick,

The 600 file permission is to do with your web server, which I am going to assume is Apache. There are possibly 2 things at play here. First is the Apache directory that your file is uploaded to. I think what happens is your file is temporarily uploaded to the Apache directory for file uploads and is then moved by the Apache user to the assets folder of SilverStripe.

You will need to have the tech department look at the file permissions of the group for the Apache user, may be called nobody, and see what it is set to stamp files as the are uploaded.

The other thing to check is the file permissions of the Apache temp file uploaded folder.

It may be solved by setting the correct umask on apache.

Good luck
Chris

Avatar
Patrick Arlt

Community Member, 15 Posts

22 March 2010 at 11:13am

Thanks for the reply Chris, that certainly helps narrow down the problem. Do you have any advice on a workaround for this, either a Cron job or modifying the File Class to fix the permissions after upload?

Something tells me the school is going to drag their feet on this and doing a work around would be faster.