Resource Limits
resource limits are defined for each shell and its processes there are hard limits and soft limitsulimit
ulimit -{H|S}a displays your current resource limits$ ulimit -Ha core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) 4 max memory size (kbytes, -m) unlimited open files (-n) 500 pipe size (512 bytes, -p) 8 stack size (kbytes, -s) unlimited cpu time (seconds, -t) unlimited max user processes (-u) 7168 virtual memory (kbytes, -v) unlimited
$ ulimit -Sa core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) 4 max memory size (kbytes, -m) unlimited open files (-n) 300 pipe size (512 bytes, -p) 8 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 7168 virtual memory (kbytes, -v) unlimited
resource limit defined
your resource limits are defined and can be changed in a number of files !/etc/sysctl.conf
kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096
/etc/security/limits.conf
you must enable ulimits for user in security.conf !myuser hard nproc 16000 myuser soft nproc 2000 myuser hard nofile 65000 myuser soft nofile 1000
/etc/profile
if [ $USER = "myuser" ] ; then ulimit -u 10000 ulimit -n 65000 fi
.bash_profile
ulimit -n 60000
.bashrc
ulimit -n 50000
/etc/bashrc
ulimit -n 40000
ulimit problems
- you may not be able to use ulimit to INCREASE your resource limits
- if you are using SSH to connect to your server you may not even be able to use ulimit at all and might get an error as soon as you connect/login if there is a ulimit command in one of your startup scripts (unless you disable SSH PrivilegeSeparation) !
- ulimit switches are different in bash and ksh
trying to increase a ulimit
$ ulimit -n 8000 -bash: ulimit: open files: cannot modify limit: Operation not permitted
/etc/ssh/sshd_config
#UsePrivilegeSeparation yes UsePrivilegeSeparation no
see also
PluggableAuthenticationModuleUlimitSwitches
REFERRERS
HomePage