I'm using CentOS 6.3 64bit, and having trouble with increase FD limitation: SSH not working after changed the limitation, every-times I logged on my server, after typed password, then "connection closed by remote server".
It's a remote server without any "rescue mode" so there's no way to do a local login to get any error log. I also tried ulimit -SHn before this issue happened but not work as well.
Now I have to restore snapshot every-time this issue happened, and still have no idea what's wrong with my server.
Since I'm working on a high performance server handling millions of requests per second, I need a very high FD limitation, here is my configuration:
/etc/security/limits.conf * hard nofile 2000000 * soft nofile 2000000 /etc/security/limits.d/90-nproc.conf * soft nproc 1024 /etc/ssh/sshd_config Protocol 2 SyslogFacility AUTHPRIV PasswordAuthentication yes ChallengeResponseAuthentication no GSSAPIAuthentication yes GSSAPICleanupCredentials yes UsePAM yes AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS X11Forwarding yes Subsystem sftp /usr/libexec/openssh/sftp-server /etc/pam.d/sshd auth required pam_sepermit.so auth include password-auth account required pam_nologin.so account include password-auth password include password-auth session required pam_selinux.so close session required pam_loginuid.so session required pam_selinux.so open env_params session optional pam_keyinit.so force revoke session include password-auth session required pam_limits.so /etc/sysctl.conf fs.file-max = 2000000 fs.nr_open = 2000000