【问题标题】:increase ulimit for # of file descriptors增加文件描述符数的 ulimit
【发布时间】:2012-06-13 14:44:33
【问题描述】:

作为normaluser

$ ulimit -n 4096
-bash: ulimit: open files: cannot modify limit: Operation not permitted

作为 root 可以按需要运行 - 但不会影响 normaluser

如何摆脱这个第 22 条陷阱?我需要坚持下去。

【问题讨论】:

    标签: file-descriptor ulimit


    【解决方案1】:

    您可能需要查看 /etc/security/limits.conf

    【讨论】:

    • 感觉很笨拙,但我认为它完全符合我的要求。如果有更好的方法,我会稍微开放一下这个问题。
    【解决方案2】:

    在运行任何应用程序之前以普通用户身份更改文件描述符限制。

    我使用这个小实用程序fdlimit,它会在执行任何程序之前使用“setrlimit()”系统调用来增加文件描述符限制。

    我是这样用的

    $ sudo ./fdlimit <fdlimit> <program_to_run>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-23
      • 2015-01-19
      • 1970-01-01
      • 2017-07-08
      • 1970-01-01
      • 1970-01-01
      • 2014-04-25
      相关资源
      最近更新 更多