What webmasters have to know about file permissions
If you are a web master and get your website hosted in a Linux environment, but you are not very familiar with the Linux things, please keep reading. I hope this post could give you a further insight of file permissions in the Triple W filed. Or at least, bring you some ideas to get your hands dirty.
Let’s get started by looking at an example which could bring us into topics directly. An index.php file is created in WhuIsPublicFiles, just read it to get more informations http://www.hui-wang.info/WhuisPublicFiles/index.php .
I am not trying to get you confused, in contrast, it is the key point to understand file permissions. So what does 700 mean ? Yes, you are 200% right by saying that only the owner of the file is able to read it and all the others can do nothing with it. However, who is the owner ? The answer is simple, it’s me. Then who are you ? YOU are my dears readers, so you are not those “others”. The principle comes like as followings.
I get my site hosted by a web server, an apache server, in my case. It is 24/24h-7/7d there to listen to your requests. As I can’t do it for you like apache, I assign all my rights to the apache server. Apache server is running as me(Attention please, it is not always like this, apache can also run as someone else). You pass it an order by typing some kind of url in your browser, and with my rights, apache server returns you what you want. In fact, it is always a program that gets things done, and every program is running as some user. For example when we edit a text file, it is the editor that is editing it and surely with our rights assigned.
To conclude, whether your visitors could read your file depends on not only the three octal digits but also whom your web server is running as. If the server is running as the owner, your visitors are the owners and if your server is running as others, your visitors becomes the others.
P.S: All posts in this site is for purpose of exchanging opinions. You are very welcome to give us yours if you have different ones.