Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux 系統無法登入排查實錄:limits.conf 參數設定過大導致服務異常

編輯:Linux 教學

故障現象

開發反饋某測試機重啟後無法登入,本地與遠端 SSH 均失效。

排查步驟

  1. 進入單用戶模式排查
  2. 檢查磁碟狀態:正常
  3. 檢查 /etc/passwd:無異常
  4. 檢查 SSH 配置:正常
  5. 新增測試用戶,重啟仍無法登入
  6. 檢查 /etc/profile:正常

根因分析

開發曾嘗試設定最大開啟檔案數,檢視 /etc/security/limits.conf 發現:

* soft nofile 6553500
* hard nofile 6553500

設定值過大(6553500 遠超系統限制),導致登入程序無法正常初始化資源。

解決方案

註釋掉上述兩行設定,重啟系統,登入恢復正常。

經驗總結

  • limits.conf 中 nofile 參數不宜設定過大,建議參考系統預設值(通常 65535 或 1048576)。
  • 修改系統級資源限制後,務必在測試環境驗證再部署生產環境。
  • 遇到無法登入且常規檢查無果時,應檢查資源限制配置。
Copyright © Windows教程網 All Rights Reserved