0
0
Linux-cliConceptBeginner ยท 3 min read

What is 644 Permission in Linux: Explanation and Usage

In Linux, 644 is a file permission setting that means the owner can read and write the file, while the group and others can only read it. It is commonly used to allow safe sharing of files without letting others modify them.
โš™๏ธ

How It Works

Linux file permissions control who can read, write, or execute a file. The number 644 is a shorthand for these permissions using three digits. Each digit represents permissions for the owner, the group, and others, respectively.

Think of it like a house with three types of visitors: the owner, family members (group), and guests (others). The owner has the keys to enter and change things (read and write), while family members and guests can only look inside (read) but cannot change anything.

Each digit is a sum of numbers: 4 means read, 2 means write, and 1 means execute. So, 6 (4+2) means read and write, and 4 means read only. Therefore, 644 means owner can read/write, group can read, and others can read.

๐Ÿ’ป

Example

This example shows how to set a file's permission to 644 and check the result.

bash
touch example.txt
chmod 644 example.txt
ls -l example.txt
Output
-rw-r--r-- 1 user user 0 Jun 10 12:00 example.txt
๐ŸŽฏ

When to Use

Use 644 permission when you want the file owner to edit the file but allow others to only read it. This is common for configuration files, web pages, or documents that should not be changed by others but need to be accessible.

For example, website files often use 644 so the server can read them and users can view them, but only the owner can modify the content.

โœ…

Key Points

  • 6 means read and write for the owner.
  • 4 means read-only for group and others.
  • 644 is safe for files that should not be changed by others.
  • It does not allow anyone to execute the file.
โœ…

Key Takeaways

644 permission means owner can read/write, group and others can only read.
It is commonly used for files that need to be shared safely without modification.
The digits represent permissions for owner, group, and others in that order.
Use chmod 644 filename to set these permissions on a file.