---
title: 'Linux File Permissions Explained: Ownership, chmod, and Special Bits'
source: 'https://youtube.com/watch?v=4N4Q576i3zA'
video_id: '4N4Q576i3zA'
date: 2026-09-03
duration_sec: 272
channel: 'ByteByteGo'
---

# Linux File Permissions Explained: Ownership, chmod, and Special Bits

> Source: [Linux File Permissions Explained: Ownership, chmod, and Special Bits](https://youtube.com/watch?v=4N4Q576i3zA)

## Summary

This video provides a comprehensive overview of Linux file permissions, covering ownership, basic read/write/execute permissions, their binary, octal, and string representations, and practical use of the chmod command. It also explains special permission bits—setuid, setgid, and the sticky bit—and how they enhance security and collaboration in Linux environments.

### Key Points

- **Ownership Types** [00:00] — Every file or directory has three owner types: user (creator, most control), group (users sharing permissions), and others (everyone else, least control).
- **Basic Permissions** [00:32] — Three permissions: read (open/read contents), write (modify/edit), execute (run as program).
- **Permission Representations** [00:58] — Permissions shown as binary (111), octal (7), or string (rwx). Octal values: read=4, write=2, execute=1.
- **Practical Example: 764** [01:16] — Owner rwx (7), group rw- (6), others r-- (4). Set with 'chmod 764 filename'.
- **Setuid Bit** [02:05] — On executables, runs with owner's permissions. Example: passwd command. Displayed as 's' in owner execute position.
- **Setgid Bit** [02:36] — On files, runs with group's permissions; on directories, new files inherit directory's group. Displayed as 's' in group execute position.
- **Sticky Bit** [03:01] — On directories, only file owner, directory owner, or root can delete/rename files. Used on /tmp. Displayed as 't' in others execute position.
- **Setting Special Bits** [03:31] — Use chmod with symbols or numbers. Example: 'chmod 4755 important_script' sets setuid, owner rwx, group/others rx.

### Conclusion

Properly configuring file permissions and special bits is essential for preventing unauthorized access and ensuring secure, collaborative Linux environments.

## Transcript

Today, we're diving into a fundamental concept in Linux, file permissions. Understanding file permissions is crucial for maintaining security and proper access control in any Linux environment. So let's get started. First, let's talk about ownership. In Linux,
every file or directory is assigned three types of owners, the user, the group, and others. The user is the owner who created the file or directory. They have the most control over it. The group consists of users who share the same permissions to access the file or directory.
Others are users who are neither the owner nor members of the group. They have the least control. To manage access, Linux uses three types of permissions, read, write, and execute. Read allows the user to open and read file contents.
Write allows modifying or editing file contents. Execute allows the file to be run as a program. Permissions are represented in three ways, binary, octo, and string representation.
Consider the permission rwx. In binary it is 1 1 1 where each bit represents a permission Read is 1 write is 1 and execute is 1 In Octo this is represented as 7 with read being 4 write being 2 and execute being 1 added together
In string representation, it's simply RWX. Let's consider a practical example. Suppose you have a file where the owner has full permissions, which is RWX and translates to 7.
The group can read and write, which is RW- and translates to 6. Others can only read, which is r dash dash, and translates to 4. In Octo,
you could represent this as 764. Using the chmod command, you can set these permissions like this, chmod 764 and the file name. The owner can read, write, and execute the file. The group can read
and write, and others can only read. Now let's talk about special permissions bit, setuid, setgid, and the sticky bit. These provide additional control over files and directories.
The set UID bit, when set on an executable file, allows it to run with the permissions of the file owner not the user running the file This is useful for tasks that require higher privileges For example the password command which changes user passwords
has the setuid bit set. This allows regular users to change their passwords, which requires modifying sensitive system files. When the setuid bit is set, the execute bit for the owner shows as S. The setuid bit can be set on files
on files or directories. On the executable file, it allows the file to run with the permissions of the group that owns the file. On the directory, it ensures that the new files and directories created within the directory
inherit the group ownership of the directory. This is useful for shared project directories, ensuring all files created within have the same group ownership, allowing team members the necessary access permissions.
When the setGid bit is set, the execute bit for the group shows as s. The sticky bit, when set on a directory, ensures that only the file owner, the directory owner, or the root user can delete or rename the files within the directory.
This is commonly used on directories like temp to prevent users from deleting each other files When the sticky bit is set the execute bit for the others is shown as T To set these special permissions you can use the chmod command with specific symbols or
numeric representations. For example, let's say you want to set the setuid bit on an executable file named important script, along with the typical permissions of read, write, execute for the owner,
the read and execute for the group and others. In this command, for set the setuid bit, 7 gives the owner read, write, and execute permissions, and 5 gives the group and others read and execute permissions.
Understanding these permissions and special bits is essential for managing access and ensuring security in your Linux environment. Correctly setting file permissions and special bits can prevent unauthorized access
and accidental modifications, safeguarding your data and ensuring smooth collaboration. That's it for today's video on Linux file permissions. If you like our videos, you might like our system design newsletter as well.
It covers topics and trends in large-scale system design, trusted by 500,000 readers.
