- - -
(aucun droit)- - x
(exécution)- w -
(écriture)- w x
(écriture et exécution)r - -
(lecture seule)r - x
(lecture et exécution)r w -
(lecture et écriture)r w x
(lecture, écriture et exécution)Calculateur Chmod : https://chmodcommand.com
Au sein d'un serveur web, il est recommandé de mettre 644 pour les fichiers et 755 par défaut pour les dossiers (pour l’exécution : cd ).
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
Exemple de configuration des permissions dans le projet PrivateBin
#!/bin/sh # directories of privatebin pbpath='/var/www/privatebin/' pbdata='/var/www/privatebin/data/' # user, of PrivateBin and web server (may be the same, as explained above) pbuser='php' htgroup='www-data' rootuser='root' mkdir -p "$pbdata" echo "chmod" find "${pbpath}" -type f -print0 | xargs -0 chmod 0640 find "${pbpath}" -type d -print0 | xargs -0 chmod 0550 find "${pbdata}" -type f -print0 | xargs -0 chmod 0640 find "${pbdata}" -type d -print0 | xargs -0 chmod 0750 echo "chown" chown -R ${rootuser}:${htgroup} "${pbpath}/" chown -R ${pbuser}:${rootuser} "${pbdata}/"