linux - 为什么* in/etc/security/limits.conf 不包含root 用户?

标签 linux limit ulimit

我在 linux 机器上以 root 身份运行一个 java 程序。为了增加Max open files限制,我将以下行添加到 /etc/security/limits.conf

*       soft    nofile  1000000
*       hard    nofile  1000000

然而,当我通过 cat /proc/<pid>/limits 检查正在运行的程序时,它仍然告诉我 Max open files65536。直到我在 /etc/security/limits.conf 中添加了另外两行, Max open files可以更改为1000000

root       soft    nofile  1000000
root       hard    nofile  1000000

我可以看到来自 limits.conf 的评论, 它说

the wildcard *, for default entry.

所以当我使用 * 作为默认条目时,它不包括 root 用户吗?为什么?

最佳答案

正确,它不包括 root 用户。看起来这是设计使然。来自

man 5 limits.conf

NOTE: group and wildcard limits are not applied to the root user. To set a limit for the root user, this field must contain the literal username root.

关于linux - 为什么* in/etc/security/limits.conf 不包含root 用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38991351/

相关文章:

php - MYSQL PHP 的 order by 和 limit 1 返回 null

docker - ulimit 在 ssh session 中不起作用

linux - 如何让 `docker run`继承ulimits

r - 有没有办法限制运行的R进程的数量

linux - RabbitMQ Shovel 无法启动

linux - 为什么禁用中断会禁用内核抢占以及自旋锁如何禁用抢占

linux - 安装 Perl 模块 MIME::Lite 时出错

linux - 如何在目录树中查找包含 2 到 3 个子目录的目录?

sql - FoxPro 中的限制

android - 如何限制 Android 设备网络速度以进行测试