chmod modifies the permissions Unix/Linux of a file or directory. The command can use a symbolic notation or Octal The effect of the system depends also on the owner, the group, the ACL the number of the execution bits required to cross it.
Simple definition
A Linux command used to change permissions for a file or directory.
Technical definition
chmod acts on read, write, MISSION bits for the group and for the group and for the group, in symbolic or octale form.
What is it used for ?
Control who can read, edit or run a file.
Practical example
chmod 640 file.conf allows read/write to the owner and read to the group.
How to diagnose chmod ?
Before using chmod, display the rights with ls -l or stat and identify the owner and group. Then determine the value octale or symbolic adapted to the actual need: reading, writing or execution for the owner of the group. chmod 640 file gives the owner reading/writing, reading to the group and no rights to others.
Common issues
The reflex chmod 777 Often masks a problem of owner or group and unnecessarily increases exposure. On a directory, the bit x allows you to cross it; it does not have the same meaning as on a file. ACL can also complete the classic bits: check them with getfacl when the result appears inconsistent.
How to validate the correction — chmod
Apply the minimum fee required, then test with the account or service actually concerned. For a complete tree, avoid a chmod -R blind that would assign the same bits to files and folders. Document the previous value and, if necessary, use separate rules with find for directories and files.
Related terms
Key takeaway: Exact behavior and commands may vary depending on versions, products and architectures.
FAQ — chmod
What does it mean? chmod 755 ?
The owner has read, write and execute (rwx) ; the group and the others have read and run (r-x) This value is suitable for many directories or scripts, but it should not be automatically applied to all files.
What a difference between chmod and chown ?
chmod edit permission bits; chown changes the owner or group. Correcting permissions without checking the owner can mask the actual cause of a denial of access.
Why can « Permissions » stay after chmod ?
Check the rights of parents’ directories, ACL with getfacl, the context SELinux and the account that actually performs the service or order.