Changing Folder & File Permissions From 777 To 755

Hi. I moved hosting company, reinstalled CS-cart and restored the database. It has a couple of issues and I found that my new host did not support 777 permissions. These were set to 755. I am finding folders/files inside folders that still have 777. How can I easily change all files/folders that have 777 to 755 without affecting any other permission other than 777?

Also when deleting the cache folder, when it is re-created by cs-cart the permissions revert back to 777. How can I permanntly set this to 755 as I seem to be getting templete cache server errors? Thanks.

Hi. I moved hosting company, reinstalled CS-cart and restored the database. It has a couple of issues and I found that my new host did not support 777 permissions. These were set to 755. I am finding folders/files inside folders that still have 777. How can I easily change all files/folders that have 777 to 755 without affecting any other permission other than 777?

Also when deleting the cache folder, when it is re-created by cs-cart the permissions revert back to 777. How can I permanntly set this to 755 as I seem to be getting templete cache server errors? Thanks.

On a UNIX-based server with terminal access, run the following commands

to change the permissions recursively for directories only:

find /path/to/the/directory -type d -print0 | xargs -0 chmod 755

to change the permissions recursively for all files in the directory:

find /path/to/the/directory -type f -print0 | xargs -0 chmod 666

For more information about permissions in CS-Cart, please refer to the following article:

http://kb.cs-cart.com/permissions

Also when deleting the cache folder, when it is re-created by cs-cart the permissions revert back to 777. How can I permanntly set this to 755 as I seem to be getting templete cache server errors? Thanks.

You can change the default permissions in the following section of the config.local.php file:

// Default permissions for newly created files and directories
define('DEFAULT_FILE_PERMISSIONS', 0666);
define('DEFAULT_DIR_PERMISSIONS', 0777);

or if you need to do it via FTP, filezilla etc,

when setting the permissions, check the box that says recurse into sub directories or files.