debian – ulimit如何在飞行中生效?

前端之家收集整理的这篇文章主要介绍了debian – ulimit如何在飞行中生效?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
添加了2行
/etc/security/limits.conf

myuser soft nofile 16384
myuser hard nofile 16384@H_502_3@ 
 

……没有效果

su -
sysctl -p
su myuser
ulimit -n
1024@H_502_3@ 
 

重要的是,这在用户不必首先登录的情况下生效,即以root身份我代表他开始编写脚本.

解决方法

将其添加到/etc/security/limits.conf:
*               soft    nofile          16384
*               hard    nofile          16384@H_502_3@ 
 

并将这样的内容添加到/ etc / profile中,它应该适用于所有帐户:

ulimit -n 16384@H_502_3@ 
 

但是,为了让ssh和su等工具服从limits.conf文件,你需要将以下内容添加到相应的pam.d文件中(如果它还没有),即su添加到/etc/pam.d/su和对于ssh添加到/etc/pam.d/sshd:

session    required     /lib/security/pam_limits.so@H_502_3@ 
 

我相信你的特定问题可以通过上面的pam.d编辑到适当的文件解决.

原文链接:https://www.f2er.com/linux/395881.html

猜你在找的Linux相关文章