sharewind
V2EX  ›  Ubuntu

ubuntu 14.04 (trusty)如何给非 root 用户设置 ulimit 打开文件数

  •  
  •   sharewind · May 7, 2014 · 8245 views
    This topic created in 4414 days ago, the information mentioned may be changed or developed.
    ➜ sudo sysctl -a|grep file
    fs.file-max = 2037581
    fs.file-nr = 2784 0 2037581

    ➜ ~ cat /proc/sys/fs/file-max
    2037581
    ➜ ~ cat /proc/sys/fs/file-nr
    2720 0 2037581

    /etc/security/limits.conf
    * hard nofile 2037581
    * soft nofile 2037581
    root hard nofile 2037581
    root soft nofile 2037581

    /etc/pam.d/su
    session required pam_limits.so

    /etc/pam.d/common-session
    session required pam_limits.so

    reboot后仍然只能ulimit -n 4096, 再大就报
    ulimit: value exceeds hard limit
    2 replies    2014-05-07 15:50:02 +08:00
    rrfeng
        1
    rrfeng  
       May 7, 2014   ❤️ 1
    USERNAME hard nofile 2037581
    USERNAME soft nofile 2037581
    cevincheung
        2
    cevincheung  
       May 7, 2014
    /etc/security/limits.conf

    * - nofile N
    root - nofile N
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1119 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 17:48 · PVG 01:48 · LAX 10:48 · JFK 13:48
    ♥ Do have faith in what you're doing.