码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-06-24 12:05:31      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:roc   inux   文件打开   openssh   pen   conf   evo   更新   init   

在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修改了最大文件打开数不生效

标签:roc   inux   文件打开   openssh   pen   conf   evo   更新   init   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!