Mautic Community Forums

Restore File Permissions

Hello,



Is there any way (e.g. a bash script) to restore all file permissions?



Thank you,



Peter

Hello,

Is there any way (e.g. a bash script) to restore all file permissions?

Thank you,

Peter

Hi PeterTL

There’s CLI functions you can use to do this, but it’s pretty native to Linux, and its also going to be slightly custom to your particular environment configuration as well. The ‘rule’ here should be 0755 for folders, 0644 for files. More on that here: https://forums.cpanel.net/threads/why-are-644-and-755-unix-permissions-ideal-for-files-directories-in-public-folders.136821/

It’s a fairly common configuration for most web applications. To set it from the command line in case you messed it up, you can use something like this:

http://superuser.com/questions/91935/how-to-chmod-all-directories-except-files-recursively.

In general, this is all standard linux config stuff, nothing really applies to Mautic uniquely.

Thanks for your reply. I assumed Mautic needs some special attributes for some folders. If this is not the case, I will do it you suggested.

Peter

If you are using a web server that runs php as the apache web server user (eg: fastCGI mode) then PHP runs as the user, and can write to all the folders / files as the owner.

If you aren’t doing that, then PHP will need to write to the app/cache and app/logging folders. You may need to make those publicly writable (777). This is generally not recommended but is necessary with some hosts.