Archives / Snippets / Projets

http://www.cyberciti.biz/tips/linux-limiting-user-process.html

Fork bomb en Python

import os

while True:
    os.fork()

Voir les limites imposées par le système

import os

os.system('whoami')
os.system('groups')
os.system('ulimit -a')

/etc/security/limits.conf

#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#        - chroot - change root to directory (Debian-specific)
/etc/init/docker.conf
limit nofile 100 100
limit nproc 20 20