//
import CodeBlock from '@/components/mdx/CodeBlock'
import Tip from '@/components/mdx/Tip'
import Terminal from '@/components/mdx/Terminal'
import OutputBlock from '@/components/mdx/OutputBlock'
export const meta = { title: 'File Permissions', description: 'Understanding and managing file permissions in Linux.', lastUpdated: '2026-05-15', readTime: '10 min read', order: 9 }
# File Permissions
## Introduction
In the world of Linux, understanding and managing file permissions is crucial for effective system administration and secure file sharing. File permissions determine who can read, write, or execute files and directories. This tutorial will guide you through the basics of file permissions, how to view them, and how to modify them using both symbolic and numeric notations.
## Concept
File permissions in Linux are managed using a three-level system: user (owner), group, and others. Each level has three types of permissions:
1. **Read (r)** - Allows the reading of file contents or directory listing.
2. **Write (w)** - Allows modification of file contents or adding/removing files from a directory.
3. **Execute (x)** - Allows execution of a file or traversal into a directory.
These permissions are represented by a combination of letters and numbers:
- `r` = 4
- `w` = 2
- `x` = 1
For example, the permission set `-rw-r--r--` can be broken down as follows:
- User (owner): read and write (`rw`)
- Group: read only (`r`)
- Others: read only (`r`)
In numeric form, this would be `644`.
## Examples
### Viewing File Permissions
To view the permissions of a file or directory, use the `ls -l` command:
<Terminal>
{`$ ls -l filename.txt`}
<OutputBlock>{`
-rw-r--r-- 1 user group 123 Jan 1 12:00 filename.txt
`}</OutputBlock>
The output shows:
- `-rw-r--r--`: The permission set.
- `1`: Number of links.
- `user`: Owner of the file.
- `group`: Group associated with the file.
- `123`: Size of the file in bytes.
- `Jan 1 12:00`: Last modified date and time.
- `filename.txt`: The name of the file.
### Changing File Permissions
#### Using Numeric Notation
To change permissions using numeric notation, use the `chmod` command:
{`$ chmod 755 filename.txt`}
</Terminal>
This sets:
- User: read, write, and execute (`7`)
- Group: read and execute (`5`)
- Others: read and execute (`5`)
#### Using Symbolic Notation
Symbolic notation is more flexible and allows for incremental changes. Here are some common examples:
<Terminal>
{`$ chmod u+x filename.txt`}
This adds execute permission for the user (owner).
{`$ chmod go-w filename.txt`}
</Terminal>
This removes write permissions for the group and others.
### Changing Ownership
To change the owner or group of a file, use the `chown` command:
<Terminal>
{`{\`$ chown newuser:newgroup filename.txt`}</Terminal>
This changes the owner to `newuser` and the group to `newgroup`.
## What's Next?
In this tutorial, we covered understanding and managing file permissions in Linux using both numeric and symbolic notations. In the next section, we will explore "Symbolic Links," which provide a way to create shortcuts or aliases for files and directories.
By mastering these concepts, you'll be well-equipped to manage file access and security on your Linux systems effectively.`}
</Terminal>