1.临时设置

[root@host2 ~]# ulimit -n

10240

2.永久设置 在/etc/security/limits.conf  中加入

*               soft    nofile          65535

*               hard    nofile          65535

[root@host2 ~]# tail /etc/security/limits.conf  

#*               soft    core            0

#*               hard    rss             10000

#@student        hard    nproc           20

#@faculty        soft    nproc           20

#@faculty        hard    nproc           50

#ftp             hard    nproc           0

#@student        -       maxlogins       4

*               soft    nofile          65535

*               hard    nofile          65535

# End of file

如下图:

永久设置最大同时打开文件数量ulimite的方法_文件打开数

3.重启

永久设置最大同时打开文件数量ulimite的方法_重启_02

4.用ulimit命令查看

永久设置最大同时打开文件数量ulimite的方法_ulimit_03