Issue
My question is:
I created a file (in C) and then I tried to modify the permissions with chmod
using octal integers: 00647
.
I don't understand why I would still be allowed to execute this file as I set the permission 6
for the user who created the file (that's me!) knowing that 6
means I am only allowed to read and write on this file, but not execute it.
One of my thoughts was that maybe as I set the permission 7
for every users, I can execute it even if I set the permission 6
for myself which is kind of weird, I think, because that would mean that as long as I set the permission 7
for every users, other permissions do not matter. So I am not sure that is the solution.
Solution
The purpose of file permissions is to provide security.
Imagine that you maintain a system that provides access to a functionality for each user by default. If a user does something nasty you denies access for him. He then creates simply new account to gain acces for the functionality again... Oops your model is wrong!
Better way is to maintain a default deny policy and then grant permissions for particular users to particular resouces.
Answered By - mpasko256 Answer Checked By - Gilberto Lyons (WPSolving Admin)