Is it possible to make files/folders executable and readable BUT cannot be modified and can only be DELETED? How then? What permission code (ex.: 644) ?
First of all, I want to say I have no knowledge about linux filesystem permissions at all. I don’t want to mess these said permissions. One mess and I could locked out some file/s forever. Maybe, someone knows because I just can’t do trial-and-error and can’t trust the answers provided in some sites.
Groups are types of users. These can include superusers (wheel group), PHP and Apache probably have their own groups, and other users. Group is not really important on shared hosting.
Public is any other user. This user may not be the owner or part of a group, but still has access to the files. Generally, Public is denied write access, but granted read and execute access.
If you don’t give a php script execute access, you will probably get an error. If you don’t grant any file read access, then the file will be hidden and not accessible. This is pretty self-explanatory (at least to me). Maybe you should read this article to learn more about chmod:
The “Owner” is the one who created the file (So you)
The “User” is basically the web browser (Since it is what actually requests the files) or a web-bot. Like already stated, PHP scripts need “execute” access in order for them to be ran on the server, and “Read” access in order be shown by the browser to the visitor.
The “Group” term is used to define the permission of a specific “Group” (Kind of like how different trust levels have different permissions here), but are generally used for more advanced systems, like operating systems where multiple users can have accounts on one device.
Maybe not (it is actually intended for some reasons). And only selective folder/s & file/s are with these permissions.
Thank you for clarifying my thoughts @wackyblackie and @Greenreader9 ! You see every day, every minute, an idea always pop on my mind. And sometimes, I doubt how can I make it to work but can’t because of busy schedule. And I have no time to research further.
I don’t think that this is possible. Either you can make modifications to files or directories or you can’t. And if you can’t, it also means you cannot delete the files.
Also, our web servers are setup so your PHP scripts are executed as your user, so your PHP code always has access to all your files, so you never need to chmod any files or folders, e.g. to make an uploads folder writeable.