? sudo sysctl -a|grep file
fs.file-max = 2037581
fs.file-nr = 2784 0 2037581
? ~ cat /proc/sys/fs/file-max
2037581
? ~ cat /proc/sys/fs/file-nr
2720 0 2037581
Run Code Online (Sandbox Code Playgroud)
/etc/security/limits.conf
* hard nofile 2037581
* soft nofile 2037581
root hard nofile 2037581
root soft nofile 2037581
Run Code Online (Sandbox Code Playgroud)
/etc/pam.d/su
session required pam_limits.so
Run Code Online (Sandbox Code Playgroud)
/etc/pam.d/common-session
session required pam_limits.so
Run Code Online (Sandbox Code Playgroud)
然后重新启动。
但是 ulimit -n 又得到了 1024。
只能 ulimit -n 4096 作为最大值
或出错
ulimit: value exceeds hard limit
Run Code Online (Sandbox Code Playgroud)