Chmod 644 for Web Files
Learn how chmod 644 is the standard for web content files. Owner read-write, world-readable. Essential for serving static content.
Permission
644
rw-r--r--
chmod 644 filename
Permission Breakdown
| Role | Read (4) | Write (2) | Execute (1) | Octal | Meaning |
|---|---|---|---|---|---|
| Owner | r | w | - | 6 | read, write |
| Group | r | - | - | 4 | read |
| Others | r | - | - | 4 | read |
Visual Permission Grid
Detailed Explanation
The permission 644 is the universal standard for static web content files served by web servers like Apache and Nginx.
Octal breakdown:
- 6 (Owner): read (4) + write (2) = read and write
- 4 (Group): read (4) only
- 4 (Others): read (4) only
In symbolic notation this is rw-r--r--.
Web servers typically run as a dedicated user (like www-data or nginx) that is different from the file owner. The web server process needs read access to serve files to visitors. Permission 644 ensures:
- The developer/owner can edit files directly
- The web server can read and serve the files
- Nobody except the owner can modify the files
- The files are not executable (an important security measure)
Files that should use 644 include HTML documents, CSS stylesheets, JavaScript files, images (JPEG, PNG, SVG, WebP), font files, XML files, JSON data files, and any other static content. PHP files are an exception in some configurations: if PHP runs as CGI, PHP files might need execute permission (755), but with PHP-FPM (the modern standard), 644 is correct.
Use Case
The required permission for all static web content: HTML, CSS, JavaScript, images, fonts, and documents served by Apache, Nginx, or any standard web server.