環(huán)境
centos7.9
問題
阿里云ecs昨天無法使用jumpserver登錄deploy用戶,其他用戶卻可以登錄。比如可以正常登錄root,然后我su - deploy 賬號,無法正常切換,直接報錯提示:failed to execute /bin/bash: Resource temporarily unavailable.
jumpserver連接deploy賬號直接提示:ssh: could not start shell
原因
這個一個安全性的問題,避免普通用戶使用太多的進(jìn)程。默認(rèn)4096
cat /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 4096
root soft nproc unlimited
解決
更改所有用戶的進(jìn)程數(shù)量為8192.文章來源:http://www.zghlxwxcb.cn/news/detail-513107.html
cat /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 8192
root soft nproc unlimited
使用ansible解決(可選)
tasks:
- name: Add or modify hard nofile limits for wildcard domain
community.general.pam_limits:
domain: "*"
limit_type: soft
limit_item: nproc
value: 8192
dest: /etc/security/limits.d/20-nproc.conf
有關(guān)limits.d的知識,可以參考這個文章:
/etc/security/limits.conf 詳解與配置
failed to execute /bin/bash: Resource temporarily unavailable(Linux系統(tǒng)root無法通過su切換到某個普通用戶)文章來源地址http://www.zghlxwxcb.cn/news/detail-513107.html
到了這里,關(guān)于阿里云ecs /etc/security/limits.d/20-nproc.conf參數(shù)優(yōu)化的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!