Tux Notes

March 16, 2026

File permissions explained

Read, write and execute bits are the foundation of Linux security. Here is how to read them and change them safely.

Reading the mode string

Run ls -l and you will see strings such as -rwxr-x---. The first character is the file type; the next nine are three groups of read, write and execute bits for the owner, the group and everyone else.

Octal notation

Each group can be written as a digit: read is 4, write is 2 and execute is 1. So chmod 640 notes.txt gives the owner read/write, the group read-only access and nobody else anything.

chmod 755 deploy.sh   # rwxr-xr-x
chmod 600 id_ed25519  # rw-------

Ownership

chown alice:staff report.pdf changes the owner and group. Only root can give files away to other users.

Directories are different

On a directory, execute means "may enter" and read means "may list". A directory with 711 lets others reach files inside it only if they already know the exact names.

← All lessons