解決ssh登入報錯-bash fork retry Resource temporarily unavailable
SSH用非root使用者登入報錯,bash fork retry Resource temporarily unavailable。
引起該問題的原因可能是/etc/security/limits.d/90-nproc.conf檔案中nproc達到了上限,或者上述設定檔只針對特定使用者放開了限制,而其它使用者依然還有限制。
這裡的90-nproc.conf,可能會因機器而已。
解決方案是修改nproc上限或者修改對應的使用者賬戶,然後重啟系統生效即可。
註:此檔案是CentOS 6版本後才後該檔案,在CentOS 5.10中沒有
執行步驟如下:
1.cp-a /etc/security/limits.d/90-nproc.conf /etc/security/limits.d/90-nproc.conf.bak
註:此操作是備份檔案,避免操作失誤,可以用來還原。
2.vim/etc/security/limits.d/90-nproc.conf
#Default limit for number of user's processes to prevent
#accidental fork bombs.
#See rhbz #432903 for reasoning.
* soft nproc 1024
在此處將1024修改為更大的數值,根據需求設定即可,例如設定為:1500
#Default limit for number of user's processes to prevent
#accidental fork bombs.
#See rhbz #432903 for reasoning.
* soft nproc 1500
如果是針對特定使用者有限制,則修改對應的行內容即可,例如將:
#Default limit for number of user's processes to prevent
#accidental fork bombs.
#See rhbz #432903 for reasoning.
mayun soft nproc 1024
* soft nproc 1500
修改為:
#Default limit for number of user's processes to prevent
#accidental fork bombs.
#See rhbz #432903 for reasoning.
mayun soft nproc 2000
* soft nproc 1500
3.init 6
註:重啟系統
另外,如果這樣沒有作用,那就可以kill這個使用者的一些進程試試,如果可以,就是這個使用者的某個進程有迴圈,一直在佔用一些資源。