linux – ulimit -n not changing – values limits.conf无效

我正在尝试为ubuntu计算机上的所有用户提高打开文件描述符的最大值.

这个问题在某种程度上是对这个问题的跟进.

open file descriptor limits.conf setting isn’t read by ulimit even when pam_limits.so is required

除了我在limits.conf中添加了所需的“root”条目

这是条目

*               soft    nofile           100000
*               hard    nofile           100000
root            soft    nofile           100000
root            hard    nofile           100000

与pam_limits.so相关的行已在/etc/pam.d/中的所有相关文件中取消注释,并且fs.file-max已在/etc/sysctl.conf中正确设置

但是,我仍然看到

abc@machine-2:/etc/pam.d$ulimit -n
1024

重启后.

可能是什么问题呢?

我的认shell是/ bin / sh,我不能使用chsh来更改我的认shell,因为我的机器上的用户通过一些分布式身份验证方案进行了身份验证.

解决方法

在以root身份登录的Redhat服务器上

在/etc/security/limits.conf

user01  -       nofile  2048

strace命令以root身份登录

strace -o loglimit su - user01

与其他shell打开loglimit

grep "limit" loglimit
open("/lib64/security/pam_limits.so",O_RDONLY) = 6
 ..........
 ..........
 open("/etc/security/limits.conf",O_RDONLY) = 3
 read(3,"# /etc/security/limits.conf\n#\n#E"...,4096) = 1823
 open("/etc/security/limits.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
 setrlimit(RLIMIT_NOFILE,{rlim_cur=2*1024,rlim_max=2*1024}) = 0

我这样知道,pam_limits被加载并且limits.conf被加载了,如果你的pam_limits被加载但是你仍然看到使用ulimit -n的其他值,请检查你的shell配置文件为@etherfish告诉

相关文章

在Linux上编写运行C语言程序,经常会遇到程序崩溃、卡死等异...
git使用小结很多人可能和我一样,起初对git是一无所知的。我...
1. 操作系统环境、安装包准备 宿主机:Max OSX 10.10.5 虚拟...
因为业务系统需求,需要对web服务作nginx代理,在不断的尝试...
Linux模块机制浅析 Linux允许用户通过插入模块,实现干预内核...
一、Hadoop HA的Web页面访问 Hadoop开启HA后,会同时存在两个...