Problem Statement
What permissions does chmod 644 set?
Explanation
Octal notation uses three digits where each represents permissions for owner, group, and others. Each digit is sum of: read (4), write (2), execute (1). So 644 breaks down as: 6 (4+2 = rw-) for owner, 4 (r--) for group, 4 (r--) for others. This is standard for regular data files.
Common permission patterns: 644 (rw-r--r--) for regular files - owner can modify, others can read; 755 (rwxr-xr-x) for executables and directories - owner has full access, others can read and execute; 600 (rw-------) for sensitive files like private keys - only owner can access; 777 (rwxrwxrwx) for fully open files (insecure, rarely appropriate).
Directory permissions: read (4) allows listing contents, write (2) allows creating/deleting files, execute (1) allows entering directory and accessing files. Without execute on directory, you can't access files even if files have read permission. Understanding this is crucial: directories typically need 755 or 775 permissions to be useful.
Set permissions with chmod: chmod 644 file.txt (numeric), chmod u+x file.sh (symbolic - add execute for owner), chmod go-w file.txt (remove write for group and others). Use -R for recursive: chmod -R 755 directory. Proper permissions are critical for security, preventing unauthorized access while allowing necessary operations.
