在Debian系统中,要永久设置ulimit,您需要编辑系统配置文件
打开终端。
使用文本编辑器打开 /etc/security/limits.conf 文件。例如,使用nano编辑器,您可以输入以下命令:
sudo nano /etc/security/limits.conf
<username>和<limit>值。例如,要将用户的最大文件描述符数量设置为4096,请输入:<username> soft nofile <limit>
<username> hard nofile <limit>
将<username>替换为您要设置限制的用户名,将<limit>替换为您要设置的限制值。
例如:
john soft nofile 4096
john hard nofile 4096
保存并关闭文件。如果您使用的是nano编辑器,可以按Ctrl + X,然后按Y,最后按Enter键。
为了使更改生效,您需要重新登录用户或重启系统。
注意:这些更改仅适用于通过PAM(Pluggable Authentication Modules)进行身份验证的用户。大多数Debian系统默认使用PAM。如果您使用的是其他身份验证方法,这些更改可能不会生效。