1、用root用户登录,su - user时提示su: cannot set user id: Resource temporarily unavailable,无法愉桴狁焕进行切换用户,检查cat /etc/security/limits.conf * soft nofile 32768 * hard nofile 65536* soft nproc unlimited* hard nproc unlimited* hard core unlimited* soft core unlimited没有问题 检查系统核心参数cat /etc/sysctl.conf 也没有发现问题
2、接着检查用root用户登录 执行ulimit -acore file size (blocks, -c) unlimiteddata seg size (kbyt髫潋啜缅es, -d) unlimitedscheduling priority (-e) 0file size (blocks, -f) unlimitedpending signals (-i) 1032143max locked memory (kbytes, -l) 64max memory size (kbytes, -m) unlimitedopen files (-n) 32768pipe size (512 bytes, -p) 8POSIX message queues (bytes, -q) 819200real-time priority (-r) 0stack size (kbytes, -s) 10240cpu time (seconds, -t) unlimitedmax user processes (-u) unlimitedvirtual memory (kbytes, -v) unlimitedfile locks (-x) unlimited也没有问题执行ps -ef | grep -v grep | grep username | wc -l和 lsof| grep -v grep | grep username | wc -l 发现数字都不大 没有超出限制top一下 各项都正常
3、无奈 ps -ef | grep username kill -9 pid 干掉一些用户进程,临时登陆进来 执行ulimit -a 发现 max user processes是1024 我晕 怎么没改掉 root用户是没问题的
4、最后在/etc/security/发现有limits.d个目录,好奇之下进去看到有个名为90-nproc.conf的文件 cat一看# Default limit for number of user's processes to prevent# accidental fork bombs.# See rhbz #432903 for reasoning.* soft nproc 1024root soft nproc unlimited呵呵 问题找到了 原来在这里有限制 把那行注释掉重新登陆就可以了