
Linux File Permissions (chmod): The Complete Developer Guide
Understanding Linux file permissions is essential for every developer working with servers, Docker, or CI/CD. Here's the complete guide. The Permission Model Every file and directory has three sets of permissions for three types of users: -rwxr-xr-x 1 user group 4096 Jan 1 12:00 script.sh │└┬┘└┬┘└┬┘ │ │ │ └── Other (everyone else) │ │ └───── Group │ └──────── Owner/User └────────── File type (- = file, d = directory, l = symlink) Each set has three bits: r (read=4), w (write=2), x (execute=1) Octal Notation chmod 755 script.sh # rwxr-xr-x chmod 644 config.txt # rw-r--r-- chmod 600 private.key # rw------- chmod 777 public/ # rwxrwxrwx (avoid for security) chmod 700 ~/.ssh/ # rwx------ Common permission combos: | Octal | Symbolic | Use case | |-------|----------|----------| | 755 | rwxr-xr-x | Scripts, executables | | 644 | rw-r--r-- | Config files, static files | | 600 | rw------- | Private keys, passwords | | 755 | rwxr-xr-x | Web directories | | 640 | rw-r----- | Group-readable config
Continue reading on Dev.to DevOps
Opens in a new tab

