Portal Home > Knowledgebase > Articles Database > change permissions to all sub-folders and files inside
change permissions to all sub-folders and files inside
Posted by luespi, 05-06-2015, 01:04 PM |
I am installing Opencart 1.5.6.4. on a shared hosting for aclient
I uploaded the needed files and decompressed them
I have tried this like 7 times
and it always set the permissions wrongly on all subdirectories and files inside
They should be folders- 755 but it sets them to 775
files should be- 644 but is sets them to 664
There are too many files and subfolders to do it manually
Do you know a way to set them all at once with some script on php maybe? this a shared hosting with cpanel but it is a little bit old it runs php 5.3 and doesnt have softacoulous
Thanks a lot indeed!!!!
|
Posted by Andei, 05-06-2015, 01:16 PM |
If you have SSH access you can recursively change permissions to any folder and sub-folders/files like:
chmod -R 755 /path/to/your/folder
If you don't have SSH you can probably ask your provider to do this for you.
|
Posted by bear, 05-06-2015, 01:30 PM |
Won't that change all files also?
Some examples to work from here:
http://superuser.com/questions/91935...es-recursively
(test on something unimportant first!)
|
Posted by Andei, 05-06-2015, 01:37 PM |
Ah, true. I misunderstood part of OPs issue.
|
Posted by acm_whr, 05-06-2015, 02:45 PM |
The best way to change permission recursively is by using the following command.
Go to the directory where the opencart is installed and run
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
Now all the sub directories will be having 755 permission and all files in those directories will be of 644 permission.
|
Posted by MikeDVB, 05-06-2015, 02:47 PM |
Is it your software that is changing the permissions or are you uploading via FTP and those are just the defaults?
The suggestion about doing it via SSH is about the only way I can think to do it quickly/easily.
|
Posted by luespi, 05-07-2015, 09:27 PM |
I do not have access to shell
it is shared hosting
|
Posted by MikeDVB, 05-07-2015, 09:47 PM |
Shared hosting does not automatically preclude SSH access.
That said if you don't have it - I don't know of any good way to automate it. I suppose you could probably build a PHP script that does it via system() or something similar.
I would not suggest uploading a 'command shell' as these are generally seen as malware and can have negative repercussions on your account such as the host suspending you.
|
Posted by net, 05-07-2015, 10:16 PM |
Moved > Hosting Security and Technology.
|
Posted by techs4gnu, 05-07-2015, 11:06 PM |
If it is a shared hosting, why dont you ask your support guys to get it fixed ? They can do this in 2 simple commands
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
|
Posted by diman, 05-08-2015, 07:10 AM |
You may set that permissions using 1 line in shell like this:
chmod u-x+rwX,go-wx+rX -R /your/path/to/directory
|
Add to Favourites Print this Article
Also Read