Linux Chmod Permissions & IPv4 CIDR Subnetting Cheatsheet
Keep one bookmark for daily DevOps & server hardening: safe chmod presets (600, 644, 700, 755), SSH key fixes, RFC 1918 private subnets, and /24 to /32 CIDR host counts.
Part 1: Linux Chmod Octal Math & Production Presets
Every Linux file or directory defines three permission groups: Owner (u), Group (g), and Others (o). Each group sums three permission bits: Read = 4, Write = 2, and Execute = 1. Instead of memorizing arbitrary strings, add the bits per column—or toggle checkboxes visually in our Linux Chmod Calculator.
| Code | Symbolic | Exact Production Use Case |
|---|---|---|
600 | -rw------- | SSH private keys, TLS private keys, .env secrets, database credentials |
644 | -rw-r--r-- | HTML/CSS/JS assets, Nginx/Caddy configs, public certificates |
700 | drwx------ | ~/.ssh directory, private home folders, cron secret directories |
755 | drwxr-xr-x | Public directories (execute bit enables traversal) and executable scripts |
750 | drwxr-x--- | Service app directories shared only with the runtime group (e.g., www-data) |
Safe Recursive Pattern: Never run chmod -R 755 blindly across a website folder (that marks static files executable). Instead separate directories and files cleanly: find /var/www/site -type d -exec chmod 755 {} + followed by find /var/www/site -type f -exec chmod 644 {} +.
Part 2: IPv4 CIDR Prefix Quick Reference (/16 through /32)
CIDR notation (192.168.5.0/24) specifies how many leading bits of a 32-bit IPv4 address belong to the fixed network prefix; the remaining 32 - prefix host bits determine block size (2^(32 - prefix) total addresses).
| CIDR | Netmask | Total IPs | Usable Hosts | Typical Role |
|---|---|---|---|---|
/16 | 255.255.0.0 | 65,536 | 65,534 | Full cloud VPC CIDR block |
/20 | 255.255.240.0 | 4,096 | 4,094 | Availability-zone subnet |
/24 | 255.255.255.0 | 256 | 254 | Office / home LAN, standard subnet |
/26 | 255.255.255.192 | 64 | 62 | Microservice or Kubernetes node pool |
/28 | 255.255.255.240 | 16 | 14 | Small DMZ or NAT egress block |
/30 | 255.255.255.252 | 4 | 2 | Router-to-router point-to-point link |
/32 | 255.255.255.255 | 1 | 1 | Single host SSH / firewall allowlist |
Test exact subnet boundaries and octet bits live using IPv4 Subnet Calculator, CIDR to IP Range, and IPv4 to Binary Converter.
Frequently Asked Questions
- What chmod permissions should ~/.ssh/authorized_keys have?
- Set ~/.ssh to 700 and ~/.ssh/authorized_keys to 600 so OpenSSH accepts key-based authentication cleanly.
- What are the three RFC 1918 private IPv4 ranges?
- 10.0.0.0/8 (16.7M IPs), 172.16.0.0/12 (1.04M IPs), and 192.168.0.0/16 (65,536 IPs).
- Why do point-to-point router links sometimes use /31 instead of /30?
- RFC 3021 allows /31 subnets on point-to-point links to use both addresses without wasting network and broadcast IDs.