修改/etc/security/limits.conf导致无法登录问题

一、操作:
修改/etc/security/limits.conf

  • hard nofile 1200000

二、现象:

  1. ssh登录后退出
  2. 控制台登录后界面空白

三、定位:
使用光盘引导,进入Rescue System查看message

ssh登录相关日志
Apr 10 11:01:36 Linux sshd[14007]: Accepted keyboard-interactive/pam for usr_ins from 192.168.222.125 port 37472 ssh2
Apr 10 11:01:36 Linux sshd[14007]: pam_limits(sshd:session): Could not set limit for ‘nofile’: Operation not permitted
Apr 10 11:01:36 Linux sshd[14007]: error: PAM: pam_open_session(): Permission denied

控制台登录相关日志
Apr 10 11:01:50 Linux login[13736]: pam_limits(login:session): Could not set limit for ‘nofile’: Operation not permitted
Apr 10 11:01:50 Linux login[13736]: Permission denied

四、解决:
sysctl 设置 fs.nr_open 大于等于 /etc/security/limits.conf 的 hard nofile

    原文作者:custa
    原文地址: https://www.jianshu.com/p/ec860e0b1c95
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞