Skip to main content

Understanding chmod in Detail

4.1 Numeric Permissions​

Permissions can be set using numbers:

  • 4 = read (r)
  • 2 = write (w)
  • 1 = execute (x)

Common combinations:

  • 755 = rwxr-xr-x (owner: read/write/execute, group/others: read/execute)
  • 644 = rw-r--r-- (owner: read/write, group/others: read only)
  • 777 = rwxrwxrwx (all permissions for everyone - use cautiously!)

4.2 Practice with chmod​

Current location: ~/linux_tutorial/scripts

Create a test file in the scripts directory and experiment:

touch test_permissions.txt
chmod 644 test_permissions.txt # Read/write for owner, read for others
ls -l test_permissions.txt

chmod 755 test_permissions.txt # Add execute permission
ls -l test_permissions.txt

chmod 600 test_permissions.txt # Only owner can read/write
ls -l test_permissions.txt