问题复现,切换用户或者使用ssh登录出现以下问题

$su someuser
su: failed to execute /bin/bash: Resource temporarily unavailable
$ssh someuser@localhost
shell request failed on channel 0

原因:Linux系统会限制用户的最大进程数。应用程序占满进程数过后,执行任何命令都会报Resource temporarily unavailable

解决方案: 增加(Increase nproc value)

#查看nproc值大小

#增加nproc值大小 由4096改为65535

vim /etc/security/limits.conf

root soft nofile 65535
root hard nofile 65535
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535

vim /etc/security/limits.d/20-nproc.conf

*          soft    nproc     65535
*          hard    nofile  65536
root       soft    nproc     unlimited

nproc:表示max number of processes
nofile:表示max number of open file descriptors
hard/soft:soft是一个警告值,而hard则是一个真正意义的阀值,超过就会报错。

Logo

一站式 AI 云服务平台

更多推荐