WCC logo

CIS120Linux Fundementals

Linux Permissions

Lesson: Understanding Linux Permissions

Linux permissions are a fundamental aspect of the operating system's security model, controlling the access rights of users to files and directories. Each file and directory in Linux is associated with an owner (author), a group, and permission settings for three categories of users: the owner, the group, and everyone else.

Owner (Author), Group, and Everyone

Owner (Author): The owner is typically the user who created the file or directory. By default, the owner has full control over the file or directory, meaning they can read, write, and execute it. The owner can also change the permissions for the group and others.

Group: Each file and directory is associated with a group. Users in this group have specific permissions that can be different from those of the owner. This is useful in collaborative environments where a set of users need to share access to files and directories.

Everyone (Others): This category includes all other users who are not the owner and do not belong to the group associated with the file or directory. Permissions for others are generally more restrictive to maintain security.

Types of Permissions

There are three types of permissions in Linux:

  1. Read (r): Permission to read the contents of the file or directory.
  2. Write (w): Permission to modify the contents of the file or directory.
  3. Execute (x): Permission to execute the file, if it is a script or program. For directories, execute permission allows users to enter the directory and access its contents.

Viewing Permissions

You can view the permissions of files and directories using the ls -l command. The output provides detailed information, including the permission settings.

Example:

$ ls -l
-rwxr-xr-- 1 user group  4096 Jul 10 14:55 file.txt

The output can be broken down as follows:

The permission string -rwxr-xr-- can be interpreted as: