chmod

A command that changes a file's permission bits, using either octal digits or symbolic changes.

In more detail

chmod +x adds execute permission so a script can be run as a program, and chmod 644 sets read and write for the owner and read for everyone else. Only the owner or root may change a file's permissions.

Examples

chmod +x dynamic.py makes an inventory script executable so Ansible runs it instead of parsing it.
In playbooks, the mode argument of the file and copy modules sets permissions idempotently.
chmod +x script.sh
chmod 600 secret.txt
chmod 640 report sets the whole mode; chmod g+w report only adds group write. Only the file's owner or root can change a mode. Always check the owning group too, because the same mode on the wrong group grants the wrong people access.

Related terms

Taught in

References

Certification courses