Linux File Permissions

Hi everyone!

(In context of Infinityfree File System)

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.

chmod-calculator.com may help you. Remember, though, that if you go below 600, you will effectively lose access to that directory. I recommend permissions 755 or 655.

3 Likes

Thank you! But I can’t seem to understand User, Group, Public concepts.

Is User means who created the file or the owner of the entire filesystem?

And what is Group? It is very broad term. Is Group means any other user which can access the files like the Admin?

Is Public means some entity like scripts from PHP ?

User is, well the user, such as epiz_28764243.

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:

3 Likes

Then perhaps start with a guide that overviews everything, like this one on CHMOD.

I agree with @wackyblackie here.

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.

3 Likes

Thank you everyone! I like your feedbacks!
Back to the question:

I came up with 575 permission. I assume I can’t modify the file directly, but a PHP script can able to modify them, right? (Please check my understanding if it’s correct)

1 Like

Well, you probably want to give yourself write access…

image

2 Likes

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.

Anyways, thanks! :smile:

4 Likes

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.

2 Likes

751 would be the best perm set

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.