ubuntu设置ulimit

centos系统的设置ulimit的时候是直接修改/etc/security/limits.conf文件,但是在ubuntu中却不行,

ubuntu先修改/etc/security/limits.conf文件

* soft     nproc          65535
* hard     nproc          65535
* soft     nofile         65535
* hard     nofile         65535

root soft     nproc          65535
root hard     nproc          65535
root soft     nofile         65535
root hard     nofile         65535
注意L这个每个用户都要配置,有些说只有root用户才需要写出来,但是有时候测试的时候发现普通用户没有写在这没有生效
test soft     nproc          65535
test hard     nproc          65535
test soft     nofile         65535
test hard     nofile         65535

添加common-session
在/etc/pam.d/common-session文件中,添加下面一行内容
session required pam_limits.so

重启系统就可以生效
 
原文地址:https://www.cnblogs.com/yangzhaon/p/12059693.html