Archive for August 13, 2019

The maximum number of connections is too large,Causes SSH to fail to log in

pam_limits(login:session): Could not set limit for ‘nofile’: Operation not permitted

COULD NOT SET LIMIT FOR ‘NOFILE’: How to deal with OPERATION NOT PERMITTED

If you need to allow users to use large file resources, you need to modify the kernel's file resource limit first
Modify the number of files that the user can open generally directly modify the nofile of limits.conf,However, if you modify this value to millions, it is likely that ssh cannot be logged in.、System abnormal
Because it is very likely that the number of files that can be opened by the user exceeds the number of files that can be opened by the kernel
The correct modification method is as follows:
Modify the number of files that can be opened by the kernel first,Modify the number of files that the user can open
The specific location of the kernel limit is:
/proc/sys/fs/file-max-the number of files that can be opened by all processes at the system level
/proc/sys/fs/nr_open-defines the maximum allowable modification of file-max,file-max cannot exceed this value
Modify /etc/sysctl.conf to increase:
fs.file-max =***
fs.nr_open = ***
You can modify the configuration of the kernel
After modification,Then modify /etc/security/limits.conf
* soft nofile *** * hard nofile ***
Also change here /etc/security/limits.d/90-nproc.conf

Comments off