V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sharewind
V2EX  ›  Ubuntu

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

  •  
  •   sharewind · 2014-05-07 13:59:31 +08:00 · 7320 次点击
    这是一个创建于 3642 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ➜ 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 条回复    2014-05-07 15:50:02 +08:00
    rrfeng
        1
    rrfeng  
       2014-05-07 14:28:24 +08:00   ❤️ 1
    USERNAME hard nofile 2037581
    USERNAME soft nofile 2037581
    cevincheung
        2
    cevincheung  
       2014-05-07 15:50:02 +08:00
    /etc/security/limits.conf

    * - nofile N
    root - nofile N
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2852 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 14:58 · PVG 22:58 · LAX 07:58 · JFK 10:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.