不重启系统,更改 Linux ulimit 中的open files

kevin.Zhu 发布于:2013-1-16 11:35 分类:Linux  有 14 人浏览,获得评论 0 条  

############################ 这种修改只能改当前用户的 #################

ulimit -a 查看当前的 open files
默认是 1024

1、在 /etc/profile 尾部添加

ulimit -n 8192


2、使设置生效

source /etc/profile


3、检查设置是否生效

ulimit -a


############################# 以下修改可以修改所有用户的 ########################

修改ulimit -n 的最大值,永久修改为65535

1.vim /etc/security/limits.conf 最后添加

  1. * soft nofile 65535

  2. * hard nofile 65535

2.vim /etc/pam.d/login最后添加

  1. session required /lib/security/pam_limits.so

3.退出当前会话,重新登录

  1. [root@localhost ~]# ulimit -n

  2. 65535