zoukankan      html  css  js  c++  java
  • su: cannot set user id: Resource temporarily unavailable

    [root@Proxy01 init.d]# service tomcat8084 stop
    Stopping Tomcat: su: cannot set user id: Resource temporarily unavailable
    [root@Proxy01 init.d]# id tomcat
    uid=501(tomcat) gid=501(tomcat) groups=501(tomcat)
    [root@Proxy01 init.d]# cd /tmp
    [root@Proxy01 tmp]# ls
    Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>  hsperfdata_tomcat  mysql.sock  qtsingleapp-aegisG-46d2  qtsingleapp-aegiss-a5d2  zabbix_agentd.log
    
    [root@Proxy01 tmp]# ulimit -a
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 62794
    max locked memory       (kbytes, -l) 64
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 65535
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) 10240
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 62794
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited
    
    
    查看配置:
    
    # End of file
    * soft nofile 65535
    * hard nofile 65535
    
    nproc就是"max user processes",完整描述是: nproc - max number of processes


    su: cannot set user id: Resource temporarily unavailable

    直接通过其他机器ssh www@xxx.xxx.xxx.xxx时,提示 Write failed: Broken pipe  。首先去查看了下/etc/profile文件,也有如下的ulimit配置:

    ulimit -S -c 0 > /dev/null 2>&1
    ulimit -HSn 65000
    ulimit -u 65000

    注:后面的-u参数为最大进程数,如果害怕其他用户通过fork死循环耗完本机资源,可以适当减少该值。默认该值为1024 。

    接着看/etc/security/limits.conf 文件,发现其下面已新增了nofile的值 ,如下:

    www           soft   nproc       65535
    www           hard   nproc       65535
    *           soft   nofile       65535
    *           hard   nofile       65535

    注:limits.conf文件实际上就是ulimit命令的配置文件。nproc为打开的最大进程数,nofile为打开的最大文件数。该处和上面的/etc/profile是重复设置的。实现上该处增加了以后,/etc/profile就不用再做配置的,而且该处配置更规范些,可以对用户进行限制 。

    即然以上两处都做了设置,还是有上面的提示,神奇了。后来又乱折腾了半天,突然想到之前在centos 6.3版本配置的时候,发现centos 6.X以后新增了一个/etc/security/limits.d/90-nproc.conf 文件,用于控制nproc 。这里面的默认配置是

    *          soft    nproc     1024
    root       soft    nproc     unlimited

    1024大小显然对我运行程序的www用户来说,太少了点。更改为65535后,再su - www时,问题解决 。烦人的提示不再有 。


  • 相关阅读:
    强化学习课程学习(2)——必备数学基础集锦
    强化学习课程学习(1)——深度学习前期回顾
    疑难杂症-使用pandas_profiling查看EDA数据文档遇到的一些坑
    YOLOv3的论文详解
    YOLO2——YOLO9000,Better, Faster, Stronger论文详解
    YOLO——You Only Look Once论文详解
    第十二章-自我总结
    第十一章-CRF的奇妙之处
    nodejs Sequelize CLI Access denied for user 'root'@'localhost' (using password: NO)
    (52)指针 (53)数组的增删改查
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350856.html
Copyright © 2011-2022 走看看