0% found this document useful (0 votes)
11 views3 pages

Linux_File_Permissions_Lesson_Notes

Linux employs a permission model to manage access to files and directories, with three types of permissions: read, write, and execute. Permissions are assigned to three user categories: owner, group, and others, and can be viewed using the `ls -l` command. The `chmod`, `chown`, and `chgrp` commands are used to change permissions and ownership of files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Linux_File_Permissions_Lesson_Notes

Linux employs a permission model to manage access to files and directories, with three types of permissions: read, write, and execute. Permissions are assigned to three user categories: owner, group, and others, and can be viewed using the `ls -l` command. The `chmod`, `chown`, and `chgrp` commands are used to change permissions and ownership of files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lesson Notes: Basic Linux File Permissions

1. Introduction

Linux is a multi-user operating system. To ensure system security and user privacy, Linux uses a robust

permission model to control access to files and directories. Every file and directory in Linux has permissions

that determine who can read, write, or execute it.

2. Types of Permissions

There are three types of permissions in Linux:

r (Read): View the contents of a file or list contents of a directory

w (Write): Modify the file or directory contents

x (Execute): Run the file as a program or access a directory

3. User Categories

Permissions are assigned to three types of users:

Owner (u): The user who owns the file

Group (g): The group assigned to the file

Others (o): All other users on the system

4. Viewing Permissions

Use the `ls -l` command to view permissions:

$ ls -l

-rwxr-xr-- 1 alice staff 1234 May 17 10:00 myscript.sh

Explanation:

- '-' -> file type (dash for file, 'd' for directory)

- 'rwx' -> owner permissions

- 'r-x' -> group permissions


Lesson Notes: Basic Linux File Permissions

- 'r--' -> others permissions

5. Changing Permissions: chmod

Use the chmod command to change file permissions.

Symbolic mode:

chmod u+x file.txt # Add execute to owner

chmod g-w file.txt # Remove write from group

chmod o=r file.txt # Set others to read-only

Numeric mode:

Permissions values:

r = 4, w = 2, x = 1

Examples:

chmod 755 script.sh # rwxr-xr-x

chmod 644 file.txt # rw-r--r--

6. Changing Ownership: chown and chgrp

To change ownership:

sudo chown newowner file.txt

To change group:

sudo chgrp newgroup file.txt

7. Practice Examples

touch testfile # Create a file

ls -l testfile # Check default permissions

chmod u-w testfile # Remove write from owner

chmod 700 testfile # Owner full, others none


Lesson Notes: Basic Linux File Permissions

8. Summary

- Linux permissions control who can read, write, and execute files.

- Use `ls -l` to view permissions.

- Use `chmod` to change permissions.

- Use `chown` and `chgrp` to change file ownership.

You might also like