- 1 1. Introduction
- 2 2. What Is chmod? (Basic Understanding)
- 3 3. Understanding the Meaning of -rw-r–r–
- 4 4. How to Set -rw-r–r– Using chmod (Practical Guide)
- 5 5. Checking Permissions with the ls -l Command
- 6 6. Checking and Changing Permissions Using GUI Tools (Beginner-Friendly)
- 7 7. Important Notes and Troubleshooting for chmod
- 8 8. Practical Use Cases and Common Scenarios
- 9 9. Frequently Asked Questions (FAQ)
- 9.1 Q1. What is the difference between chmod 644 and -rw-r--r--?
- 9.2 Q2. What happens if a file has no execute permission?
- 9.3 Q3. Is it safe to set 644 on directories?
- 9.4 Q4. Are there any risks when using chmod -R?
- 9.5 Q5. I keep getting “Permission denied.” What should I check?
- 9.6 Q6. I want to share a file but prevent editing. What should I do?
- 9.7 Q7. I accidentally changed permissions. How can I restore them?
- 10 10. Summary
1. Introduction
What Are “Access Permissions” in Linux?
In Linux and Unix-like systems, properly managing file and directory access permissions is extremely important. This is essential not only from a security standpoint, but also for maintaining stable system operations.
Many people have probably wondered what symbols like -rw-r--r-- mean when viewing file lists in the terminal.
The Relationship Between chmod and -rw-r–r–
These symbols represent file access permissions using symbolic notation. The chmod command is used to set and modify these permissions. In other words, when you use chmod to assign specific permissions to a file, the result is displayed as symbols like -rw-r--r--.
Purpose of This Article and Intended Audience
This article explains what -rw-r--r-- actually means and how to set or change it using chmod, in a way that is easy for beginners to understand. We also cover security considerations and practical real-world usage examples.
The content is intended for everyone from Linux beginners to intermediate users who are becoming comfortable with terminal operations, with the goal of providing practical knowledge usable in real work environments.
2. What Is chmod? (Basic Understanding)
The Role of the chmod Command
chmod (pronounced “change mode”) is a command used in Linux and Unix-like operating systems to modify file and directory access permissions.
Using this command allows you to flexibly control who can perform which operations (read, write, execute).
Proper permission settings are crucial not only for security, but also for preventing file sharing and execution issues.
Basic Syntax of chmod
chmod [options] [permissions] filenameFor example:
chmod 644 sample.txtThis command changes the permissions of sample.txt as follows:
-rw-r--r-- 1 user group 1234 Apr 13 20:00 sample.txt- Owner (user): read and write allowed (rw-)
- Group: read-only (r–)
- Others: read-only (r–)
Two Ways to Specify Permissions
There are two methods for specifying permissions with chmod:
- Numeric mode
- Example:
chmod 755 script.sh - This method assigns permissions using numbers.
- Symbolic mode
- Example:
chmod u=rw,g=r,o=r file.txt - This method uses symbols such as u (user), g (group), o (others), and r/w/x.
Both methods produce the same results. Numeric mode is fast for bulk changes, while symbolic mode allows more flexible control.
Difference Between chmod and chown
A commonly confused command is chown:
chmod: changes access permissionschown: changes file owner and group
Since their purposes differ, it is important to clearly understand the role of each command.
3. Understanding the Meaning of -rw-r–r–
Structure of Permission Symbols
When you run ls -l in Linux, file information is displayed in the following format:
-rw-r--r-- 1 user group 1234 Apr 13 2025 sample.txtThe leftmost part, -rw-r--r--, represents the file’s access permissions. Understanding this allows you to know exactly who can do what with the file.
Detailed Breakdown of Each Part
① First character: file type
| Symbol | Meaning |
|---|---|
- | Regular file |
d | Directory |
l | Symbolic link |
b | Block device |
c | Character device |
In the case of -rw-r--r--, the leading - indicates a regular file.
② Characters 2–10: permissions (3 characters × 3 sets)
- Owner (user):
rw-
Read and write are allowed; execute is not. - Group:
r--
Read-only. - Others:
r--
Read-only.
This means that only the owner can edit the file, while everyone else can only view it.
Numeric Representation: What 644 Means
Linux permissions can also be expressed using numeric (octal) notation.
The numeric equivalent of -rw-r--r-- is 644.
| User Type | Symbolic | Number | Meaning |
|---|---|---|---|
| Owner | rw- | 6 | Read + Write |
| Group | r-- | 4 | Read only |
| Others | r-- | 4 | Read only |
The numeric values are calculated as follows:
- Read (r) = 4
- Write (w) = 2
- Execute (x) = 1
Thus, rw- = 4 + 2 = 6, and each r-- = 4, resulting in 644.
Why This Permission Is Commonly Used
-rw-r--r-- (644) is a very common permission for public files and static web server content such as HTML and CSS.
- Only the owner can modify the file, preventing unintended changes
- Other users can read the file, allowing sharing and public access
When used correctly, this setting balances security and usability.
4. How to Set -rw-r–r– Using chmod (Practical Guide)
Changing Permissions with the chmod Command
File and directory access permissions can be freely changed using the chmod command. For example, if you want to set permissions to -rw-r--r--, simply apply permission 644.
Setting Permissions Using Numeric Mode
Use the format chmod 644 filename.
chmod 644 document.txtThis command changes the permissions of document.txt as follows:
-rw-r--r-- 1 user group 1234 Apr 13 20:00 document.txt- Owner (user): read and write allowed (rw-)
- Group: read-only (r–)
- Others: read-only (r–)
Setting Permissions Using Symbolic Mode
If you need more flexible control, symbolic mode is useful.
chmod u=rw,g=r,o=r document.txtThis command means:
u=rw: grant read and write permissions to the ownerg=r: grant read-only permission to the groupo=r: grant read-only permission to others
The result is exactly the same as using numeric mode 644.
Important Notes When Applying Permissions to Directories
Unlike files, directories require execute permission (x) to be accessible.
For example, the following setting may restrict access:
chmod 644 my_folderWith this configuration, read permission is granted, but users cannot enter the directory because execute permission is missing.
Correct example:
chmod 755 my_folder- Owner: read, write, execute
- Group and others: read and execute
This allows other users to list and access files inside the directory.
Recursively Changing Permissions: The -R Option
If you want to change permissions for many files and subdirectories at once, use the -R (recursive) option.
chmod -R 644 my_folderThis applies permission 644 to all files under my_folder. However, this approach comes with important caveats.
5. Checking Permissions with the ls -l Command
How to View File Permissions
To check file and directory permissions in Linux, use the standard ls -l command. This displays detailed information such as permissions, owner, file size, and last modified date.
Basic Usage
ls -lThe output looks like this:
-rw-r--r-- 1 naoya devs 2048 Apr 13 20:00 index.htmlEach column has the following meaning:
| Field | Description |
|---|---|
-rw-r--r-- | Permissions |
1 | Number of hard links |
naoya | Owner (user) |
devs | Group |
2048 | File size (bytes) |
Apr 13 20:00 | Last modified date |
index.html | File name |
How to Read the Permission Field
Focus on the -rw-r--r-- portion. It can be broken down as follows:
- First character: file type
-: regular filed: directoryl: symbolic link- Remaining nine characters: permissions (3 × 3 sets)
- Owner:
rw-→ read and write - Group:
r--→ read-only - Others:
r--→ read-only
This tells you that only the owner can edit the file, while others can only read it.
Checking a Specific File
To check permissions for a specific file, specify the file name:
ls -l index.htmlThis is useful when working in directories containing many files.
Checking Directory Permissions
Directories can also be checked using ls -l. To view the directory itself rather than its contents, use the -d option.
ls -ld my_folderThis displays permission information for my_folder only.
Safe Permission Management
After modifying permissions with chmod, it is recommended to always verify the result using ls -l.
Incorrect settings can lead to security issues or unexpected behavior.
You can also combine it with pipes for filtering:
ls -l | grep '.sh'This filters and displays only shell script files.
6. Checking and Changing Permissions Using GUI Tools (Beginner-Friendly)
An Option for Those Uncomfortable with the Command Line
Linux is often operated via the terminal and command line, but many beginners feel that text-based interfaces are difficult or error-prone.
For such users, file permissions can also be checked and modified using GUI (Graphical User Interface) tools.
Using the Ubuntu File Manager (Nautilus)
Linux distributions such as Ubuntu include a default file manager called Nautilus, similar to Windows Explorer.
How to check permissions:
- Right-click the target file or directory
- Select “Properties”
- Open the “Permissions” tab (labeling may vary by version)
What you can do there:
- View and change owner and group (administrator privileges required)
- Toggle read, write, and execute permissions
- Changes are applied immediately
Instead of symbolic notations like rw- or r--, permissions are shown in plain-language descriptions such as “Read-only” or “Read and write”, making them easy to understand for beginners.
WinSCP (SFTP Client for Windows Users)
When connecting from Windows to a remote Linux server, WinSCP allows permission management through a GUI.
Steps:
- Log in to the server using WinSCP
- Right-click a file and select “Properties”
- Change permission values (e.g., 644) or use checkboxes
- Click “OK” to apply changes
Advantages:
- Permissions can be viewed in both numeric and symbolic formats
- Recursive permission changes are supported via GUI
Notes:
- Files requiring root privileges may not be modifiable without sudo permissions
WinSCP is a popular free file manager for Windows supporting…

FileZilla (Cross-Platform SFTP Client)
The cross-platform SFTP client FileZilla, available for macOS and Linux, also allows permission changes.
Steps:
- Connect to the server
- Right-click the target file
- Select “File Permissions”
- Adjust permissions using checkboxes or numeric values and click “OK”
Advantages and Caveats of GUI-Based Operations
Advantages:
- Less prone to mistakes for beginners
- Changes can be visually confirmed immediately
- No need to memorize command syntax
Caveats:
- Some server environments do not allow permission changes via GUI tools
- Displayed values may not always reflect actual applied permissions, so verification with
ls -lis recommended
FileZilla - The free FTP solution for both client and server…
7. Important Notes and Troubleshooting for chmod
It Still Doesn’t Work—Why?
Even after changing permissions using chmod, files may not behave as expected. In most cases, this is due to misconfigured permissions or misunderstandings.
Below are common real-world issues and their solutions.
“Permission denied” Errors
Symptom:
bash: ./script.sh: Permission deniedCause:
- The file does not have execute permission (x)
Solution:
chmod +x script.shOr using numeric mode:
chmod 755 script.shNote that having read or write permission does not imply execution permission.
Directories Without Execute Permission Cannot Be Accessed
Applying chmod 644 to a directory may prevent access to its contents.
Reason:
- Execute permission (x) on directories is required to enter and list their contents.
Example:
chmod 644 my_folder
ls my_folderThis may result in an error.
Fix:
chmod 755 my_folderPitfalls of Recursive Changes (-R)
While chmod -R is convenient, it applies the same permissions to both files and directories, which can cause unexpected issues.
Common mistake:
chmod -R 644 /var/www/htmlThis removes execute permissions from directories, making them inaccessible.
Correct approach:
# Apply execute permissions to directories
find /var/www/html -type d -exec chmod 755 {} \;
# Apply file permissions
find /var/www/html -type f -exec chmod 644 {} \;Owner and Group Mismatch
Permissions alone are not enough; file ownership and group settings also matter.
For example, if a web server user such as apache needs to read a file, but the owner is a regular user and others lack read permission, the file will not be served correctly.
Solutions:
- Change owner:
sudo chown www-data:www-data index.html - Grant group access:
chmod 640 index.html(if group is appropriate)
Why chmod 777 Is Dangerous
Some users attempt to fix issues by setting permissions to 777, but this is extremely dangerous.
Reasons:
- Anyone can read, write, and execute the file
- High risk of tampering or malicious script execution
Recommended best practices:
- Files: 644 or 600
- Directories: 755 or 700
- Scripts/Binaries: 755 (as needed)
8. Practical Use Cases and Common Scenarios
How Are chmod Permissions Used in Real-World Environments?
The chmod command and permissions such as -rw-r--r-- are frequently used in real server operations and development environments.
Below are several representative scenarios illustrating how permissions are applied in practice.
1. Managing HTML Files on a Web Server
Scenario:
When publishing HTML files on a web server such as Apache or Nginx, the typical permission is -rw-r--r-- (644).
chmod 644 index.htmlWhy 644?
- The owner (site administrator) needs write access
- The web server user (e.g., www-data) only needs read access
- Write access for others is unnecessary and unsafe
This configuration enables secure publication of web content using the principle of least privilege.
2. Granting Execute Permission to Script Files
Scenario:
You created a shell script backup.sh, but execution fails with a “Permission denied” error.
chmod 755 backup.shMeaning of this setting:
- Owner: read, write, execute (rwx)
- Group and others: read and execute (rx)
This allows others to run the script while restricting editing to the owner.
3. Restricting Access to Sensitive Files
Scenario:
You manage a file secrets.txt containing API keys or passwords and want to prevent anyone else from accessing it.
chmod 600 secrets.txtMeaning:
- Owner: read and write only
- Group and others: no access
This is a critical security best practice. Sensitive files should always be managed with 600 or 400 (read-only).
4. Securely Sharing a Directory
Scenario:
You create a shared directory shared_folder accessed by multiple developers.
chmod 770 shared_folderMeaning:
- Owner and group: full permissions (rwx)
- Others: no access
By assigning the development team as the group, you enable secure and efficient collaboration. Group membership can be adjusted using chgrp.
5. Avoiding Problems Caused by Misconfiguration
Scenario:
You accidentally run chmod -R 777 ., making all files writable by anyone.
Recommended precautions:
- Always use
findto differentiate between files and directories - Check permissions beforehand with
ls -l - Test changes in a staging environment first
9. Frequently Asked Questions (FAQ)
Q1. What is the difference between chmod 644 and -rw-r--r--?
A. They represent the same permission; only the notation differs.
chmod 644: numeric permission specification-rw-r--r--: symbolic representation shown byls -l
Q2. What happens if a file has no execute permission?
A. Executing scripts or binaries will fail.
bash: ./script.sh: Permission deniedFix:
chmod +x script.shQ3. Is it safe to set 644 on directories?
A. Generally, no.
Directories require execute permission (x) to be accessible.
Correct setting:
chmod 755 directory_nameQ4. Are there any risks when using chmod -R?
A. Yes. The same permissions are applied to both files and directories.
chmod -R 644 my_project/This removes execute permissions from directories.
Safer approach:
find my_project/ -type d -exec chmod 755 {} \;
find my_project/ -type f -exec chmod 644 {} \;Q5. I keep getting “Permission denied.” What should I check?
A. Verify the following:
- The file has execute permission if it is being executed
- You are the owner or have write permission
- The directory has execute permission
- You have sudo privileges if required
Q6. I want to share a file but prevent editing. What should I do?
A. Use permissions 644 or 444.
chmod 644 share.txt- 644: others can read only
- 444: everyone has read-only access
Q7. I accidentally changed permissions. How can I restore them?
A. Compare with a correctly configured file.
ls -l /path/to/correct_fileReapply permissions using chmod. Ideally, document default permissions for your project.
10. Summary
Why Understanding chmod and Permissions Matters
This article explained the chmod command and the meaning of symbolic permissions such as -rw-r--r--, which are widely used in Linux and Unix-like systems.
These concepts are essential for ensuring system security, operational stability, and accurate file sharing.
Key Takeaways
chmodmodifies file and directory access permissions-rw-r--r--means the owner can read and write, others can only read- Numeric (
644) and symbolic (-rw-r--r--) representations are equivalent - Permissions can be set using numeric or symbolic modes
ls -lis used to verify permissions- GUI tools such as Nautilus, WinSCP, and FileZilla can also manage permissions
- Incorrect permissions often cause “Permission denied” errors
- There is always a reason behind commonly used permission patterns
The “Best” Permission Depends on Context
There is no universal permission setting that fits all cases.
Permissions should always be chosen based on purpose, users, and required security level.
Final Advice
While permissions may seem complex at first, mastering chmod enables you to prevent issues proactively and operate systems securely.
Always ask yourself:
Who should access this file, and for what purpose?
Keeping this perspective will help you build safe and reliable Linux environments.





