How does Linux file permissions system work and what is the chmod command?

Medium Topic: General June 17, 2026

Linux file permissions control who can read, write, and execute files. Permissions operate at three levels: owner, group, and others.

Permission Types

Read (r = 4): View file contents or list directory. Write (w = 2): Modify file or add/delete files in directory. Execute (x = 1): Run file as program or enter a directory.

Reading Permissions

ls -la displays: -rwxrw-r– where the first character is file type (- file, d directory, l symlink), then three groups of rwx for owner, group, and others.

chmod Command

Symbolic mode: chmod u+x file adds execute for owner; chmod g-w file removes group write; chmod o=r file sets others to read-only.

Octal mode: chmod 755 file sets owner=rwx(7), group=rx(5), others=rx(5). Common permissions: 644 for regular files (owner rw, others r), 755 for executables and directories, 600 for private keys.

chown and chgrp

chown user:group file: Change owner and group. chown -R user:group dir/: Recursively change ownership. chgrp devs file: Change group only.

Special Permissions

SetUID (s on owner execute): File runs with owner’s permissions (e.g., passwd command). SetGID (s on group execute): File runs with group permissions; on directories, new files inherit group. Sticky bit (t): Only owner or root can delete files in directory – used on /tmp to prevent users deleting each other’s files.

Practice Similar Questions

No related questions found.

Back to General Topics