How to modify ulimit for open files on SUSE Linux Enterprise Server 10.4 permanently?

SERVER:/etc # ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 96069
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 96069
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
SERVER:/etc # 

How can I set the limit of the root user from 1024 to something else, PERMANENTLY? How can I set the ulimit globally? Will the changes take effect in the moment?

p.s.: I already googled for it but can’t find the file where I can set it permanently:

SERVER:/etc # grep -RiI ulimit * 2>/dev/null | egrep -v ":#|#ulimit"
init.d/boot.multipath:      ulimit -n $MAX_OPEN_FDS
init.d/multipathd:      ulimit -n $MAX_OPEN_FDS
rc.d/boot.multipath:        ulimit -n $MAX_OPEN_FDS
rc.d/multipathd:        ulimit -n $MAX_OPEN_FDS

and..:

SERVER:/etc # grep -RiI 'MAX_OPEN_FDS' * 2>/dev/null
init.d/boot.multipath:MAX_OPEN_FDS=4096
init.d/boot.multipath:  if [ -n "$MAX_OPEN_FDS" ] ; then
init.d/boot.multipath:      ulimit -n $MAX_OPEN_FDS
init.d/multipathd:MAX_OPEN_FDS=4096
init.d/multipathd:  if [ -n "$MAX_OPEN_FDS" ] ; then
init.d/multipathd:      ulimit -n $MAX_OPEN_FDS
rc.d/boot.multipath:MAX_OPEN_FDS=4096
rc.d/boot.multipath:    if [ -n "$MAX_OPEN_FDS" ] ; then
rc.d/boot.multipath:        ulimit -n $MAX_OPEN_FDS
rc.d/multipathd:MAX_OPEN_FDS=4096
rc.d/multipathd:    if [ -n "$MAX_OPEN_FDS" ] ; then
rc.d/multipathd:        ulimit -n $MAX_OPEN_FDS
SERVER:/etc # 
Asked By: gasko peter

||

Use pam_limits(8) module and add following two lines to /etc/security/limits.conf:

root hard nofile 8192
root soft nofile 8192

This will increase RLIMIT_NOFILE resource limit (both soft and hard) for root to 8192 upon next login.

Answered By: Petr Uzel
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.