How to chmod directories and files right way

Jovani

Well-known member
Registered
Joined
Jul 10, 2012
Messages
141
Points
0
Hey Guys,

How to set permissions for my files and directories on my web hosting right way

when I should chmod 777, 755, 644 or 444 for them?

I was advised that should not chmod 777 for any folders to make my website more secure, is that exact?
 

MightWeb

Well-known member
Registered
Joined
Mar 9, 2015
Messages
126
Points
0
That depends entirely on the file itself, and what it's used for. When setting CHMOD, you have three categories - the owner (in the Linux filesystem), the group (in the Linux filesystem), or the public.
You can then set whether or not the owner/group/public can read, execute or write to the file. So, 755 for example, means the owner can read, execute and write to the file - whilst other members of his *nix group, or any user, can only read/execute the file.

As you may notice, it's dependant on the file entirely, and what it is actually used for. There's no "one right answer" to which properties should be set.
 

MarcS

Member
Registered
Joined
Jul 31, 2015
Messages
16
Points
0
Following are ideal permissions:

Public_html folder == 750
Any subfolder under Public_html folder == 755
Any file under Public_html folder == 644

Following is the explanation of the permissions. I hope it would be helpful to you to assign the correct permissions.


Owner :: READ(4) + WRITE(2) + EXECUTE(1) ==7
Group :: READ(4) + WRITE(2) + EXECUTE(1) ==7 [Not Recommended]
World :: READ(4) + WRITE(2) + EXECUTE(1) ==7

Owner :: READ(4) + WRITE(2) + EXECUTE(1) ==7
Group :: READ(4) + EXECUTE(1) ==5
World :: READ(4) + EXECUTE(1) ==5

Owner :: READ(4) + WRITE(2)==6
Group :: READ(4)==4
World :: READ(4)==4

Owner :: READ(4)==4
Group :: READ(4)==4 [Read Only]
World :: READ(4)==4
 
Latest Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top