【问题标题】:linux limits.conf not working?linux limits.conf 不起作用?
【发布时间】:2014-08-02 12:30:53
【问题描述】:

我是这样配置 /etc/security/limits.conf 的。

user1               soft    core            0
user1               hard    core            0

然后,我重新启动系统并以 root 身份登录 然后我就这样做了。

su user1
ulimit -c unlimited

然后我执行了一个错误的应用程序来生成核心文件。 由于我从limits.conf将核心限制设置为零,我预计核心不会生成,但结果并非如此,核心是正常生成的。 怎么了??

我们将不胜感激。

【问题讨论】:

    标签: linux core limits


    【解决方案1】:

    limits.confpam_limits.so读取,所以需要检查/etc/pam.d/su中是否启用了这个模块。在我的系统上,默认情况下已将其注释掉:

    # Sets up user limits, please uncomment and read /etc/security/limits.conf
    # to enable this functionality.
    # (Replaces the use of /etc/limits in old login)
    # session    required   pam_limits.so
    

    一旦取消注释,模块将立即开始工作。如果您仍然有问题,请检查您的身份验证日志(可能是 /var/log/auth.log),该日志将写入与限制相关的错误。

    【讨论】:

      【解决方案2】:

      也尝试这样做

      # echo DefaultLimitNOFILE=65535 >> /etc/systemd/system.conf
      # echo DefaultLimitNOFILE=65535 >> /etc/systemd/user.conf
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-04-15
        • 2011-12-19
        • 2014-12-19
        • 1970-01-01
        • 2019-05-14
        • 2012-10-06
        相关资源
        最近更新 更多