Users in the same group are allowed to read and execute the file: READ (4) + EXECUTE (1) = 5.Īll the other users should be blocked: 0 (they have NO rights). Some chmod examplesĪs an example, let’s assume the owner can do anything with the file: READ (4) + WRITE (2) + EXECUTE (1) = 7. The first digit is for the owner, the second number for the group and the last number for other users. Now this doesn’t help much, since we need to specify which user will get this right.įor this we need to understand how the magic number is setup. So if we want to allow reading and executing, then we get: READ (4) + EXECUTE (1) = 5. To calculate this “magic” number we simply need to add numbers.Įach “right” has a value. For example: your private files, or have read only access to the company phonebook, or have the ability to run a program without the ability to delete or damage the program. Obviously, setting the proper access rights is important to prevent users from getting access to files or directories they should not have access to, or have limited access to. – for the OWNER of the file, the GROUP of users of which the owner is part, and for the OTHER users. It’s commonly used in Unix like systems (which includes Linux and MacOS X) to set the access rights to files and directories, and determine: “ chmod” stands for “ Change Mode” which doesn’t tell us much.