Directory Permissions

It’s important to understand permissions if you deal with files and directories on a Linux server. Linux has a file and directory authorization scheme to ensure that only those who are supposed to have access to a directory or file can actually do so. Permissions are set for three categories of users for each file and directory:

The owner or developer of the file or directory is known as the user.
A community is a list of users who have been granted permission to use a directory or file in some way.
Any else who isn’t the owner, maker, or a member of the correct community is referred to as the “world.” (Think of “world” as a collection of public permissions.)

  1. For each kind of user, there are three basic categories of permissions:
    • Read: Any type of user who is allowed Read access can do just that, read a file. If a user only has this permission, they can open the file or directory, and see the contents, but they may not make changes.
    • Write: If the user has Write permission, they can make changes to a file and save those changes or in the case of a directory, they can put files and directories inside that directory. It is possible to have write-only access to a directory or file.
    • Execute: In the case of binary files (code designed to run on Linux), a user with Execute access can run that file or items in that directory. Think of this permission as the ability to launch an application (though it is a bit more complex than that).

A three-digit number is the most common way of referring to permissions. When dealing with web applications (scripts), you’ll often be advised to modify the permissions on files and directories to a three-digit amount. Every type of authorization, in this system, is assigned a unique numerical value: Read permissions are 4, Write permissions are 2, and Execute permissions are 1, no permissions at all is 0. These numbers are added together for each kind of user.

Leave a Reply

Your email address will not be published. Required fields are marked *