Linux
如何永久修改 SUSE Linux Enterprise Server 10.4 上打開文件的 ulimit?
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 #
如何將 root 使用者的限制從 1024 永久設置為其他值?如何在全域範圍內設置 ulimit?更改會立即生效嗎?
ps:我已經用Google搜尋了它,但找不到可以永久設置它的文件:
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
和..:
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 #
使用 pam_limits(8) 模組並將以下兩行添加到
/etc/security/limits.conf
:root hard nofile 8192 root soft nofile 8192
這將在下次登錄時將 root 的 RLIMIT_NOFILE 資源限制(軟和硬)增加到 8192。