tech:ulimit
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:ulimit [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:ulimit [2025/09/01 16:14] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # ulimit | ||
| + | |||
| + | Voir aussi : | ||
| + | * prlimit | ||
| + | |||
| + | Depuis Redhat 6 nous avons : | ||
| + | |||
| + | ''/ | ||
| + | ~~~ | ||
| + | # Default limit for number of user's processes to prevent | ||
| + | # accidental fork bombs. | ||
| + | # See rhbz #432903 for reasoning. | ||
| + | * soft nproc 1024 | ||
| + | root | ||
| + | www-data | ||
| + | ~~~ | ||
| + | |||
| + | Options ulimit : | ||
| + | |||
| + | * -H : Hard | ||
| + | * -S : Soft | ||
| + | * -a : All | ||
| + | * -u : Nombre maximal de processus utilisateurs | ||
| + | |||
| + | ~~~bash | ||
| + | ulimit -a -H | ||
| + | ulimit -a -S | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | help ulimit | ||
| + | ~~~ | ||
| + | |||
| + | Voir < | ||
| + | |||
| + | ~~~bash | ||
| + | :(){ :|:& };: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | En cas de dépassement : comment le sait-on ? | ||
| + | >> Grsecurity propose un audit des dépassements des " | ||
| + | |||
| + | Message d' | ||
| + | |||
| + | Pourquoi ne pas utiliser les cgroups ? | ||
| + | |||
| + | ## Core dump | ||
| + | |||
| + | Désactiver les cores dumps (Redhat) | ||
| + | |||
| + | ''/ | ||
| + | ~~~bash | ||
| + | # No core files by default | ||
| + | ulimit -S -c 0 > /dev/null 2>&1 | ||
| + | ~~~ | ||
| + | |||
| + | Activer les cores dumps (Redhat) | ||
| + | ~~~bash | ||
| + | su - | ||
| + | ulimit -c unlimited | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Notes | ||
| + | |||
| + | ~~~bash | ||
| + | /bin/bash -c ulimit -S -c 0 >/ | ||
| + | ~~~ | ||
| + | |||
| + | ### Temps réel | ||
| + | |||
| + | However, for systems with a Linux kernel 2.6.13 or newer, it is possible to allow processes without root privileges to set the real-time scheduling policy. | ||
| + | When the Linux PAM module is installed (which is normally the case) you can control the maximum real-time priority for non-privileged processes on a per user or group basis via the / | ||
| + | |||
| + | For example, adding the line | ||
| + | ~~~ | ||
| + | | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Outils | ||
| + | |||
| + | Appliquez les modifications directement à un processus en cours d' | ||
| + | |||
| + | |||
| + | ## Python | ||
| + | |||
| + | ~~~python | ||
| + | import resource | ||
| + | |||
| + | print(resource.getrlimit(resource.RLIMIT_NOFILE)[1]) | ||
| + | ~~~ | ||
