今天干了一件事情,在將/etc/security/limits.conf中的nofiles參數修改成比較大的值以後,再運行su命令或者ssh登陸系統的時候,出現下面的提示:linux
# cat /etc/security/limits.conf grid hard nofile 6553600
在MOS上進行了搜索,發現文章Running "su" Returns the Error "could not open session" (文檔 ID 1632114.1),提到了下面內容:session
The nofile value of /etc/security/limits.conf is larger than fs.nr_open value.
nr_open:ssh
This denotes the maximum number of file-handles a process can
allocate. Default value is 1024*1024 (1048576) which should be
enough for most machines. Actual limit depends on RLIMIT_NOFILE
resource limit.code
能夠經過在sysctl.conf文件中使用fs.nr_open參數來調整參數大小。文檔
# sysctl -a |grep nr_open fs.nr_open = 1048576
說到這裏,問題的解決方法已經有了,減少nofiles的值,或者增長fs.nr_open的值。
對於我來講,修正這個問題就須要我去一趟機房,用單用戶模式來修復這個問題了。對linux系統的瞭解還很不夠啊。it