linux – “打开文件”ulimit:通过limits.conf控制
发布时间:2020-12-13 16:51:40 所属栏目:Linux 来源:网络整理
导读:我正在敲打这个,我无法理解为什么它不起作用.我希望有人能够阐明这一点,或者没有这样做,给我一些调查途径的建议. 我有一个Red Hat 7.3系统(不要问)哪里需要增加wls81用户的打开文件限制.我以为我只是无法控制它,但它越来越看起来好像我只是遇到了我需要改变
我正在敲打这个,我无法理解为什么它不起作用.我希望有人能够阐明这一点,或者没有这样做,给我一些调查途径的建议.
我有一个Red Hat 7.3系统(不要问)哪里需要增加wls81用户的打开文件限制.我以为我只是无法控制它,但它越来越看起来好像我只是遇到了我需要改变的用户的问题.我在/etc/security/limits.conf中添加了以下行: wls81 soft nofile 10100 wls81 hard nofile 10240 madhatta soft nofile 10100 madhatta hard nofile 10240 正如我所知,正在调用pam_limits.so: [madhatta@server madhatta]$sudo grep limits /etc/pam.d/* /etc/pam.d/login:session required /lib/security/pam_limits.so /etc/pam.d/sshd:session required /lib/security/pam_limits.so /etc/pam.d/su:session required /lib/security/pam_limits.so /etc/pam.d/system-auth:session required /lib/security/pam_limits.so 当我像我一样ssh,我得到新的软限制,并可以增加到硬限制: desktop> ssh server Last login: Thu May 10 13:20:13 2012 from a.b.c.d [madhatta@server madhatta]$ulimit -n 10100 [madhatta@server madhatta]$ulimit -n 10200 [madhatta@server madhatta]$ulimit -n 10200 [madhatta@server madhatta]$ulimit -n 10300 bash: ulimit: cannot modify open files limit: Operation not permitted 但是当我作为wls81用户使用时,我不能: desktop> ssh wls81@server Last login: Wed May 9 22:29:33 2012 from a.b.c.d [wls81@server wls81]$ulimit -n 1024 [wls81@server wls81]$ulimit -n 10000 bash: ulimit: cannot modify open files limit: Operation not permitted 当我su – 每个用户时也会发生同样的事情.老实说,我不明白为什么这个用户无法重置其ulimits.有人有主意吗? 解决方法
嗯,这个谜就解决了.我发现当我做su – wls81时我得到了1024的限制,但是当我刚刚做了wls81时,我得到了新的,更高的限制.事实证明,wls81的.bash_profile调用了另一个脚本,该脚本又从系统上完全不同的用户调用了一个环境设置脚本,该脚本执行了ulimit -n 1024.
当我删除该行时,wls81现在获得新的限制. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |