Search tools

Developer guides

chmod 644 Meaning: Safe File Permissions for Web Servers and Nginx

What does chmod 644 mean? Learn why 644 is the standard for web server files, how it prevents arbitrary file edits, and how to apply it across your site.

3D dark glassmorphic consoles displaying Owner read-write status alongside Group and Public read-only tokens

If you manage a web server running Nginx, Apache, WordPress, or Node.js, you have seen chmod 644 in documentation hundreds of times.

The quick definition is: chmod 644 gives the file owner read and write access (rw-), while allowing everyone else on the system to only read the file (r--). Nobody is granted permission to execute it.

You can calculate octal modes and symbolic strings with our free chmod calculator.

Here is why 644 is the universal standard for web files and how to configure it on your servers.

Breaking down the 644 permission bits

In Linux, a 3-digit octal permission represents three distinct groups of users:

  1. First digit (6): Owner (User)
  2. Second digit (4): Group
  3. Third digit (4): Others (World / Public)

Each digit is the sum of three binary flags: Read (4), Write (2), and Execute (1).

Owner (6):   4 + 2 + 0  = Read + Write      (rw-)
Group (4):   4 + 0 + 0  = Read only         (r--)
Others (4):  4 + 0 + 0  = Read only         (r--)

Written in standard Unix symbolic notation, 644 appears as: -rw-r--r--

$ ls -l /var/www/html/styles.css
-rw-r--r-- 1 deploy deploy 4096 Nov 12 12:00 styles.css

Why web servers require 644

Web servers like Nginx and Apache run under dedicated, unprivileged system accounts (usually www-data, nginx, or apache).

When an external user visits https://example.com/logo.png: 1. Nginx receives the HTTP request. 2. Nginx checks if its user (www-data) has Read (4) permission for logo.png. 3. Because the last digit of 644 is 4, Others can read the file. Nginx streams the file across the socket to the client.

If you mistakenly set the file to 600 (rw-------), only the owner can read it. Nginx will return an HTTP 403 Forbidden error.

If you set the file to 777 (rwxrwxrwx), anyone on the machine can modify it. An attacker exploiting an upload vulnerability in another directory could overwrite your CSS, inject malicious JavaScript, or alter your configuration.

644 strikes the ideal balance: your deploy user can update files, web visitors can read them, and malicious actors cannot tamper with them.

Why files need 644 but directories need 755

A common pitfall is running chmod -R 644 /var/www/html.

Doing this will instantly crash your website.

In Linux, directories use the Execute (+x, 1) bit differently than files. For a folder, execute permission does not mean running a binary; it means permission to traverse and search the directory.

If a folder is set to 644, web servers cannot enter it to locate the files inside, causing an immediate 403 Forbidden error across your entire site.

Always keep files and directories separate:

# Correct recursive permissions for web roots:
find /var/www/html -type d -exec chmod 755 {} +
find /var/www/html -type f -exec chmod 644 {} +

If you ever need to inspect permission differences across directories, our Linux file permissions guide details how ownership (chown) and modes (chmod) interact.

To generate exact command flags and test symbolic strings like u=rw,go=r, use the ToolQuilt chmod calculator.

Read next