活到老学到老  

记录遇到问题的点点滴滴。

【Linux】limits.conf 不重启就生效或者不生效的原因

6年前发布  · 2165 次阅读
  limits 

前阵子,我要用到使Linux的文件打开数为65534个,而且需要永久生效,于是将配置写到了:

vim /etc/security/limits.conf

* soft nofile 65534
* hard nofile 65534

重新登录后limit.conf的配置都不生效,后来发现,ubuntu有个bug,root用户必须注明用户

root soft nofile 65534
root hard nofile 65534

也就是写成上面那样,重新登录不需要重启,ulimit -a可以看到文件打开数已经是65534了,这就是limits.conf不生效的原因,注意ubuntu一定不能直接用*