BCE-C712 Linux System Administration

0 of 74 lessons complete (0%)

Introduction to Linux System Administration

Overview of Permissions in Linux

You don’t have access to this lesson

Please register or sign in to access the course content.

Introduction: Permissions in Linux dictate who can do what with a file or directory. They are a crucial aspect of system security and access control. Understanding and managing permissions is fundamental for Linux system administrators.

Key Concepts:

  1. User, Group, and Others:
    • Linux divides users into three categories: the owner of the file (user), members of the file’s group (group), and everyone else (others).
  2. Three Types of Permissions:
    • Read (r): Allows viewing or reading the contents of a file or directory.
    • Write (w): Allows modifying or creating new files within a directory, and editing existing files.
    • Execute (x): Allows running a file if it is a script or program, or accessing contents within a directory.
  3. Permission Modes:
    • Permissions are represented in a three-character string (e.g., rwxr-xr--).
    • The first set of characters represents the owner’s permissions, the second set represents the group’s permissions, and the third set represents others’ permissions.
  4. Symbolic Notation:
    • In symbolic notation, permissions are represented using letters (r for read, w for write, x for execute) and symbols (+ for adding, - for removing).
    • Example: chmod u+w file.txt adds write permission for the owner of file.txt.
  5. Numeric Notation:
    • In numeric notation, each permission is assigned a numeric value (read = 4, write = 2, execute = 1).
    • Example: chmod 755 file.txt gives the owner full permissions, and read/execute permissions to group members and others.

Default Permissions:

  • When a file or directory is created, it inherits default permissions based on the umask value set in the user’s profile.

Special Permissions:

  • Setuid (s) and Setgid (g): These permissions allow a user to execute a file with the privileges of the file’s owner or group respectively.
  • Sticky Bit (t): Applied to directories, it ensures that only the owner of a file in the directory can delete or rename it.

Changing Permissions:

  • chmod: Command used to change file permissions.
  • chown: Command used to change the owner of a file or directory.
  • chgrp: Command used to change the group associated with a file or directory.