eolas/zk/chmod.md

1.2 KiB

tags created
permissions
Linux
Friday, April 11, 2025

chmod

Modify file permissions.

We can use symbols or numbers.

For example:

chmod +x filename

To make a file executable.

When we use numbers this is called an absolute change, because all permission bits are being set at once in octal notation.

Best just to memorise the most common sequences. Bear in mind that some only apply to files, rather than directories or executable programs.

Mode Meaning Applied to
644 user: r/w, group/other: r files
600 user: r/w, group/other: none files
755 user: r/w/e, group/other: r/e directories, programs
700 user: r/w/e, group/other: none directories, programs
711 user: r/w/e, group/other: execute directories

Useful options

-v → verbose: tell the user what chmod is doing

-r → work recursively, i.e apply the action to directories as well as files

You can list the contents of a directory if it's readable but you can only access a file in a directory if the directory is executable!