加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

debian – ulimit如何在飞行中生效?

发布时间:2020-12-14 02:34:36 所属栏目:Linux 来源:网络整理
导读:我添加了2行 /etc/security/limits.confmyuser soft nofile 16384myuser hard nofile 16384 ……没有效果: su -sysctl -psu myuserulimit -n1024 重要的是,这在用户不必首先登录的情况下生效,即以root身份我代表他开始编写脚本. 解决方法 将其添加到/etc/se
我添加了2行
/etc/security/limits.conf

myuser soft nofile 16384
myuser hard nofile 16384

……没有效果:

su -
sysctl -p
su myuser
ulimit -n
1024

重要的是,这在用户不必首先登录的情况下生效,即以root身份我代表他开始编写脚本.

解决方法

将其添加到/etc/security/limits.conf:
*               soft    nofile          16384
*               hard    nofile          16384

并将这样的内容添加到/ etc / profile中,它应该适用于所有帐户:

ulimit -n 16384

但是,为了让ssh和su等工具服从limits.conf文件,你需要将以下内容添加到相应的pam.d文件中(如果它还没有),即su添加到/etc/pam.d/su和对于ssh添加到/etc/pam.d/sshd:

session    required     /lib/security/pam_limits.so

我相信你的特定问题可以通过上面的pam.d编辑到适当的文件来解决.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读