首页 > 其他 > 详细

Centos7修改了最大文件打开数不生效

时间:2020-06-24 13:01:35      阅读:265      评论:0      收藏:0      [点我收藏+]

在limit.conf配置文件中添加了如下配置

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

另启终端查看最大文件打开数ulimit -n仍然为1024

经过各种百度搜查,发现以前更新过openssl和openssh,导致/etc/pam.d/sshd模块丢失,当sshd_config设置UsePAM yes的时候,无法ssh,我们现在添加sshd配置

[root@k8s-master idcs]# cat /etc/pam.d/sshd
#%PAM-1.0
auth       required    pam_sepermit.so
auth       substack     password-auth
auth       include      postlogin
# Used with polkit to reauthorize users in remote sessions
-auth      optional     pam_reauthorize.so prepare
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open env_params
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      password-auth
session    include      postlogin
# Used with polkit to reauthorize users in remote sessions
-session   optional     pam_reauthorize.so prepare

然后重启sshd并另启终端查看最大文件打开数(生效了)

[root@k8s-master idcs]# systemctl restart sshd
[root@k8s-master idcs]# ulimit -n
131070

 

Centos7修改了最大文件打开数不生效

原文:https://www.cnblogs.com/cpw6/p/13186736.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!