chmod

Change file or directory permissions.

high risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
Safer / dry-run alternatives
stat -c '%a %U:%G %n' <path>Record the current mode/owner.
chmod -R u=rwX,g=rX,o= <dir>Capital X sets execute only on directories and already-executable files.
What it does

chmod modifies read/write/execute permissions for owner, group, and others. Accepts symbolic (u+x) or octal (755) notation. Octal is precise and unambiguous — 755 means owner rwx, group r-x, others r-x. The -R flag applies changes recursively.

Common flags
FlagMeaning
-R --recursiveApply changes recursively to directories
-v --verbosePrint a message for each changed file
-c --changesReport only files that are changed
Examples
chmod 600 ~/.ssh/id_ed25519Restrict private key to owner-read only (SSH requirement) · explain & risk-check →
chmod 644 /etc/nginx/nginx.confReadable by all, writable only by owner · explain & risk-check →
chmod +x deploy.shMake a script executable · explain & risk-check →
chmod -R 750 /opt/appSet app directory: owner rwx, group r-x, others none · explain & risk-check →
chmod u+s /usr/bin/binarySet SUID bit — runs as file owner · explain & risk-check →
Pro tip

Remember '7=rwx, 6=rw-, 5=r-x, 4=r--'. Use 644 for files, 755 for directories as baseline public defaults — and 600/700 for anything private.

Related
chown umask stat
Open the full explainer →More in Users, Permissions & Security

Reference text is hand-written and may be incomplete — check man chmod for your version. Test destructive commands on a non-production system first.