How to chmod directories and files right way

Jovani

Active member
Joined
Jul 10, 2012
Messages
338
Points
28
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

New member
Joined
Mar 9, 2015
Messages
182
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
Joined
Jul 31, 2015
Messages
31
Points
8
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
Replies
3
Views
93
Hi
Replies
1
Views
44
Replies
2
Views
54
Replies
1
Views
137
Recommended threads
Replies
10
Views
7,792
Replies
3
Views
1,713
Similar threads

Referral contests

Referral link for :

Sponsors

Popular tags

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