How chmod Works in Kali Linux

In Kali Linux (and all Linux systems), the chmod command is used to change file or directory permissions. It controls who can read, write, or execute a file.

Permission Basics

Each file has three types of permissions for three classes of users:

Example permission string
-rwxr-xr--

This means:

Syntax

chmod [options] mode file

Two Ways to Set Permissions

1) Symbolic Mode

Use letters (u, g, o, a) and operators (+, -, =):

chmod u+x script.sh       # add execute for owner
chmod g-w file.txt        # remove write for group
chmod o=r file.txt        # set others to read only
chmod a+r file.txt        # everyone can read

2) Octal (Numeric) Mode

Numbers represent permissions where r=4, w=2, x=1. Add them for each class.

NumberPermission
7rwx
6rw-
5r-x
4r--
3-wx
2-w-
1--x
0---
chmod 755 script.sh   # rwx for owner, r-x for group/others
chmod 644 file.txt    # rw- for owner, r-- for group/others
chmod 700 secret.txt  # rwx for owner only

Special Permissions

chmod 1777 /tmp   # sticky bit set, common for /tmp

Summary

chmod changes permissions so you can control access to files and directories. You can use symbolic (u/g/o/a with + - =) or octal (numbers 0–7) methods. It’s critical for security, especially when setting execute rights on scripts or restricting sensitive files.