hard nofile参数设置引起的无法ssh连接问题(涉及另一个参数fs.nr_open)

问题现象:ssh无法远程本机也无法登陆,提示报错permission denied

先进单用户模式 center os7进单用户是在启动项 按E编辑 加入/sh 按按ctrl+x进入

默认登陆单用户是read only需要重新挂载根分区 mount -o remount,rw /

查看日志 /secure 有如下报错

nofile这个关键字很重要,查看下nofile这个参数设置

vi /limits.conf

* soft nofile 102400
* hard nofile 102400
* soft nofile 102400
* hard nofile 102400

然后查看下 nr_open

cat /nr_open

100000

这个值小于hard nofile正常情况是无法这样设置的,查看vi /sysctl.conf

修改fs.nr_open大于或等于hard nofile重启后OK (也可以sysctl -w fs.nr_open=100000000)

PS:单用户模式输入exec /init退出单用户模式

问题:sysctl 设置 fs.nr_open 大于等于 /limits.conf 的 hard nofile

猜你喜欢

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注