问题
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
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
I can see the comments from limits.conf
, it says that
the wildcard *, for default entry.
So when I use * as default entry, doesn't it include root user? Why?
回答1:
Correct, it doesn't include root user. Looks like it has been done by design. From
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.
来源:https://stackoverflow.com/questions/38991351/why-in-etc-security-limits-conf-doesnt-include-root-user