Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
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 # 
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
I modified it, but it seems no effect when seeing ulimit -a with the root, even after a re-login, how to apply this change to limits.conf without a reboot? :D –  gasko peter Nov 23 '12 at 11:07
    
ulimit -n 8192 will set the limit immediately for the current shell and all its child processes. –  Petr Uzel Nov 23 '12 at 13:11
    
I'M accepting.. but afaik the machine will needs a reboot :) - until then .bash_profile.. ulimit -n 8192 –  gasko peter Nov 26 '12 at 18:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.