You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Linux operating system issue
Methods to change the system limit parameters for Linux instances
Copy page
Download PDF
Methods to change the system limit parameters for Linux instances
This topic describes how to resolve instance remote access failures caused by the nofile parameter value exceeding the nr_open parameter value by adjusting the nofile parameter in the limits.conf configuration file.​
Background​
The /etc/security/limits.conf configuration file in Linux systems is used to restrict system resources. For example, it limits the number of files, threads, and memory that users can use, thereby improving system stability. The nofile parameter in this configuration file represents the maximum number of files that all users in the system can open. /proc/sys/fs/nr_open represents the maximum number of files that a single process in the system can allocate. If the nofile parameter value exceeds the nr_open parameter value, the instance may become inaccessible via remote connection.​
Prerequisites​
Before you modify the configuration or data of an instance, we recommend that you create a snapshot first to improve fault tolerance and ensure data security.​
Procedure​
  1. Enter the Linux operating system in single-user mode. For more information, see Entering single-user mode.​
  1. Execute the following command to edit the /etc/security/limits.conf configuration file.​
  • ​
    vim /etc/security/limits.conf​
    ​
  1. Locate the root soft nofile and root hard nofile parameters, and set the parameters to the following values.​
tip​
This method makes the parameter settings take effect permanently. If you need to set the nofile parameter temporarily, use the ulimit -n [$Nofile] command to configure the nofile parameter.​
  • ​
    root soft nofile 65535​
    root hard nofile 65535​
    ​
tip​
  • soft nofile​
  • This is the warning threshold for the number of open files. We recommend that you set this parameter to the default value 65535.​
  • If you understand the purpose of this system parameter, you can modify it to a desired value, but the soft nofile value must not exceed the hard nofile value.​
  • hard nofile​
  • This is the actual threshold for the number of open files. An error will occur if the number of open files exceeds this value. We recommend that you set this parameter to the default value 65535.​
  • If you understand the purpose of this system parameter, you can modify it to a desired value, but the hard nofile value must not exceed the value of /proc/sys/fs/nr_open. If the nofile parameter value exceeds the nr_open parameter value, you may fail to log in to the instance as expected.​
  1. After the configuration file is modified, press the "Esc" key to exit edit mode and enter wq.​
  1. Press the "Enter" key to save and exit the file.​
  1. Restart the instance to make the configuration take effect.​
Last updated: 2026.04.13 16:50:02