Module 3: File Permissions
Linux has a powerful and flexible permission system that controls who can access files and directories. Understanding permissions is essential for security and proper system management.
Security First: Linux permissions are a fundamental security feature. They prevent unauthorized users from accessing sensitive files and directories.
What You'll Learn in This Module
- Understanding permission strings (rwx)
- Owner, group, and other permissions
- Changing permissions with chmod
- Changing ownership with chown
- Practical permission exercises
Module Objectives
By the end of this module, you will be able to:
- Read and interpret Linux permission strings
- Modify file and directory permissions
- Change file ownership
- Understand special permissions (setuid, setgid, sticky bit)
- Solve common permission-related issues
Why This Matters
Understanding permissions is crucial because:
- Security: Protect sensitive data from unauthorized access
- Collaboration: Share files appropriately with other users
- Web Development: Set correct permissions for web servers
- System Administration: Manage access to system resources
Permission Basics
Every file and directory in Linux has three types of permissions:
Read (r)
- Files: View file contents
- Directories: List directory contents
Write (w)
- Files: Modify file contents
- Directories: Create, delete, and rename files
Execute (x)
- Files: Run the file as a program
- Directories: Enter the directory (cd into it)
Permission Categories
Permissions are set for three categories of users:
- Owner (u): The user who created the file
- Group (g): Users who belong to the file's group
- Others (o): All other users on the system
Reading Permissions
When you run ls -l, you see permission strings like this:
$ ls -l
-rw-r--r-- 1 user group 1024 Dec 10 15:30 file.txt
drwxr-xr-x 2 user group 4096 Dec 10 15:30 directory/
Breaking down -rw-r--r--:
- - - File type (regular file)
- rw- - Owner permissions (read, write)
- r-- - Group permissions (read only)
- r-- - Others permissions (read only)
Memory Aid: Think of permissions as a matrix with 3 rows (owner, group, others) and 3 columns (read, write, execute).
Getting Started
Ready to master Linux permissions? Start with the first lesson about understanding permission basics.
Quick Terms to Know
Here are some terms we'll be using throughout this module:
- Owner: The user who owns the file
- Group: A collection of users with shared access
- Octal: Base-8 number system for permissions
- umask: Default permission mask
- sudo: Superuser do (execute with admin rights)
Be Careful! Incorrect permissions can make files inaccessible or create security vulnerabilities. Always test permission changes on non-critical files first.
Linux 101