为什么/etc/security/limits.conf中的*不包括root用户? [英] Why * in /etc/security/limits.conf doesn't include root user?

查看:88
本文介绍了为什么/etc/security/limits.conf中的*不包括root用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux机器上以 root 的身份运行Java程序.为了增加最大打开文件数的限制,我在/etc/security/limits.conf

I'm running a java program as root on a linux machine. In order to increase the Max open files limitation, I added the following lines into /etc/security/limits.conf

*       soft    nofile  1000000
*       hard    nofile  1000000

但是,当我通过 cat/proc/< pid>/limits 检查正在运行的程序时,它仍然告诉我最大打开文件数 65536.在我将另外两行添加到/etc/security/limits.conf 之前,可以将最大打开文件数更改为 1000000

However when I check the running program by cat /proc/<pid>/limits, it still tells me that the Max open files is 65536. Until I added another two lines into /etc/security/limits.conf, the Max open files could be changed to 1000000

root       soft    nofile  1000000
root       hard    nofile  1000000

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

I can see the comments from limits.conf, it says that

通配符*,用于默认输入.

the wildcard *, for default entry.

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

So when I use * as default entry, doesn't it include root user? Why?

推荐答案

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

Correct, it doesn't include root user. Looks like it has been done by design. From

man 5 limits.conf

注意:组和通配符限制不适用于root用户.至为root用户设置限制,该字段必须包含文字用户名root.

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.

这篇关于为什么/etc/security/limits.conf中的*不包括root用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆