sudo vim /etc/security/limits.conf
在里面增加如下内容
root soft nofile 10240
root hard nofile 10240
root soft noproc 10240
root hard noproc 10240
注意前面不带“#”
其中,
root是你想改限制的用户名
soft指软限制,hard指硬限制,超过软限制会警告,但不可能超过硬限制。软限制一定小于等于硬限制
10240是指限制的大小,还可以更大,看自己想用多少
然后输入
ulimit -n 10240
其中,10240要和上面文件中的数一致
然后查看
ulimit -a
就可以发现限制已经改掉了,并且重启之后也是可以的。