Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

php - File system permissions

It was a cms and I would like to set all my files on server to -rw-------

This will make my website working as usual? or they will not read each other, for example i have this:

require_once 'include/checksession.php';
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First, you need to understand what each "segment" means.

  • first triad what the owner can do
  • second triad what the group members can do
  • third triad what other users can do

Your permission set (-rw-------) only has permissions on the first triad - the owner of the file - which only has read and write permissions.

  • read The Read permission refers to a user's capability to read the contents of the file.
  • write The Write permissions refer to a user's capability to write or modify a file or directory.
  • execute The Execute permission affects a user's capability to execute a file or view the contents of a directory.

Therefore, the owner of the group can read the contents of the file/directory, write to the file/directory, and modify the file/directory.

Under careful file/directory ownership policies, I guess this will be okay - but I wouldn't count on it. If Apache/Nginx/... doesn't have ownership of the file, your application won't work.

This being said, I'd like to raise a few questions;

  • Why change the permissions of all files/directories on your server?
  • Why set a global permission rule, and not individual to each file/directory?
  • What's the end-goal of this?

I'd take some consideration to Jon T's answer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...