Glossary · Operating Systems & Software

chmod (File Permissions)

chmod is the Unix command that changes who may read, write, or execute a file, using permission settings for the owner, group, and everyone else.

Updated October 6, 2026

chmod (change mode) is a Unix and Linux command that sets file permissions. Each file has read, write, and execute permissions for three classes: the owner, the group, and others.

Why it matters

Correct permissions protect secrets and keep web servers working. A private key readable by everyone is a risk, while a script without execute permission will not run. Permissions can be written as letters or as a number, where read is 4, write is 2, and execute is 1, added together.

Web files typically need to be readable by the web server user, not writable.

Example

$ chmod 640 config.php
$ ls -l config.php
-rw-r----- 1 dev www-data 812 config.php

640 gives the owner read and write (6), the group read (4), and others nothing (0).

Common mistakes

  • Using chmod 777 to fix an error, which lets any user modify the file.
  • Setting execute on every file instead of only scripts and directories.
  • Fixing permissions when the real problem is the file owner; check chown.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.