limit.conf 设置不“坚持”

Bra*_*wig 8 ubuntu tcpip ulimit

试图在高负载 Web 服务器上获得相当于 ulimit -n 20000 的值,但是 ubuntu hardy 上的 /etc/security/limits.conf 似乎并没有坚持。

这是我在配置文件中设置的。

root             soft    nofile         20000
root             hard    nofile         20000
www-data             soft    nofile         20000
www-data             hard    nofile         20000
Run Code Online (Sandbox Code Playgroud)

我也试过

*             soft    nofile         20000
*             hard    nofile         20000
Run Code Online (Sandbox Code Playgroud)

重新启动后,当我在 root、www-data 或我的普通用户上运行 ulimit -n 时,我仍然看到默认的 1024。

Roy*_*Roy 8

您可能需要从 /etc/pam.d(cron、su、sudo、sshd、login)下的不同文件中取消对 pam_limits.so 的注释

session    required   pam_limits.so
Run Code Online (Sandbox Code Playgroud)