Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

silverstripe - file permissions for assets folder

it happens often that an silverstripe installation does not have the right permission to write in the assets folder - e.g. for saving resampled images...

I wonder what is the best permissions setting for the files and folders in assets/ to solve that problem. you read so many different things when you google...

can I just chmod the whole assets folder and its contents to 0777? or do files and folders need different permissions? is there an recommendation for Owner and Group? can I have "dangerous" settings?

like image 499
spierala Avatar asked May 08 '13 11:05

spierala


People also ask

How do I give permission to a folder and subfolders?

Use the chmod command to change the permissions for all files, directories, and subdirectories. Note – The permission 755 is good to set for directories but not on files. This set the execute bit on files which is not recommended for any production environments excluded some specific cases.

How do I give permission to a folder in CentOS?

In addition, CentOS can manage file and folder permissions types by group. You can change file or folder permissions on computers running CentOS using the CHMOD terminal command or by using the Nautilus file manager.


1 Answers

Rule of thumb:

  • Stuff the webserver needs to write (assets/, silverstripe-cache/) need to be writable by the server
  • Stuff the webserver needs to read (framework, cms, modules, custom code,...) should only be readable by the server

chmod 777 will work for the writeable parts, but you might want to set the folder's owner to the webserver's user (www-data, nobody, or whatever this is on your system) plus chmod 755 to avoid global write permissions.

like image 79
xeraa Avatar answered Nov 01 '22 13:11

xeraa