Permissions et sécuritéCLI Manual
$chmod
Modifier les permissions d'accès aux fichiers pour le propriétaire, le groupe et les autres.
Syntaxe de la commandePOSIX Standard
chmod [OPTIONS] MODE[,MODE]... FILE...Essayer en direct dans le bac à sable interactif
Simulation côté client sans installation avec retour instantané.
bash — terminal
AST Sandbox (Free)
Aperçu et fonctionnement
chmod gère les droits de lecture, écriture et exécution sur les fichiers et répertoires en notation octale ou symbolique.
Options et drapeaux courants
| Flag / Option | Description |
|---|---|
| 755 | rwxr-xr-x: Owner has full control; group and others can read and execute. |
| 644 | rw-r--r--: Owner can read and write; group and others can read only. |
| 700 | rwx------: Owner has full control; no access for anyone else. |
| -R | Recursively change file permissions on all subdirectories and files. |
| +x | Make a script or binary file executable for all users. |
Exemples pratiques du monde réel
#1Make a bash script executable
chmod +x /home/user/projects/demo.sh && ls -l /home/user/projects/demo.shAdds execute permissions to demo.sh and verifies the updated mode bits.
#2Set standard web file permissions (644)
chmod 644 /var/log/syslogGrants read/write to owner and read-only to group and others.