我对此感到震惊,我不明白为什么它不起作用。 我希望有人能够阐明这一点,否则就给我一些调查途径的build议。
我有一个Red Hat 7.3系统(请不要问)在哪里可以增加wls81用户的打开文件限制。 我以为我只是无法控制它,但越来越像看到我只需要改变用户的问题。 我已经/etc/security/limits.conf添加到/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 abcd [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用户ssh时,我不能:
desktop> ssh wls81@server Last login: Wed May 9 22:29:33 2012 from abcd [wls81@server wls81]$ ulimit -n 1024 [wls81@server wls81]$ ulimit -n 10000 bash: ulimit: cannot modify open files limit: Operation not permitted
当我su -给每个用户时都会发生同样的情况。 我真的不明白为什么这个用户不能重置它的ulimit 。 有人有主意吗?
那么这个奥秘就解决了 我发现,当我做了su - wls81我得到了1024的限制,但是当我刚刚做了su wls81我得到了新的,更高的限制。 事实certificate,wls81的.bash_profile调用另一个脚本,该脚本依次从系统上完全不同的用户调用环境设置脚本,该脚本执行了ulimit -n 1024 。
当我删除该行时,wls81现在获得新的限制。
我想你可能还需要检查,并可能为内核中的打开文件设置最大文件描述符:
sudo systcl fs.file-max
并编辑/etc/sysctl.conf以使更改永久。