以下样本 limits.conf 文件限制所有用户,然后为之后的其他用户设置不同限制值。此样本假设您在先前的步骤 4 中将句柄数设置为 8192。
* soft nofile 1024
* hard nofile 2048
root soft nofile 4096
root hard nofile 8192
user1 soft nofile 2048
user1 hard nofile 2048
请注意,上例中的
* 首先为所有用户设置了限制值。这些限制值低于后面的限制值。允许打开的句柄数对于 root 用户具有较大的值,而对于 user1 的数量则在两者之间。进行更改之前,请确保您阅读并理解了包含在 limits.conf 文件中的文档。