su: cannot set user id: Resource temporarily unavailable问题解决
操作环境
SuSE11sp1
问题现象
执行su - test命令切换失败,提示"su: cannot set user id: Resource temporarily unavailable"
问题分析
猜测是test使用资源超过系统的限制(比如进程数、打开的文件句柄)
1、查看/etc/security/limits.conf文件,文件并无对test用户做特殊限制
2、ulimit -a,查看输出结果与步骤1中的配置一致。
3、pf -fu test | wc -l,查看test用户打开的进程数,小于上述通用配置nproc参数值。OK
4、lsof | awk '{print $3}' | sort | uniq -c,查看test用户打开的文件句柄数。小于上述通用配置的参数值nofile。OK
5、ps -eLF | grep 'test'|wc-l,查看test用户打开的线程数(Java里面的一个线程在Linux下会最终映射成操作系统的一个进程),等于当前通用配置的参数值nproc。找到了原因。因此需要修改nproc参数。
问题解决
1、调大/etc/security/limits.conf中nproc参数。不需要重启。
2、执行ulimit -a查看确认修改已生效。
3、重新执行su - test,切换成功。问题解决
知识拓展
1、/etc/security/limits.conf文件及内容介绍
# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - a user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open file descriptors
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-, ]
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
# #* soft core
#* hard rss
#@student hard nproc
#@faculty soft nproc
#@faculty hard nproc
#ftp hard nproc
#@student - maxlogins # End of file
@users soft nofile
@users hard nofile
@root soft nofile
@root hard nofile
2、ulimit命令,设置限制,可以把命令加到profile文件里,也可以在/etc/security/limits.conf文件中定义限制。
常用参数如下
-a 显示所有限制
-n 打开文件数的上限
-u 进程数的上限
-c core文件大小的上限
-d 进程数据段大小的上限
-f shell所能创建的文件大小的上限
-m 驻留内存大小的上限
-s 堆栈大小的上限
-t 每秒可占用的CPU时间上限
-p 管道大小
-v 虚拟内存的上限
su: cannot set user id: Resource temporarily unavailable问题解决的更多相关文章
- su: cannot set user id: Resource temporarily unavailable
今天R&D所在主机出现su: cannot set user id: Resource temporarily unavailable资源不可用报错,直接通过其他机器ssh huyuh@xxx ...
- “su: cannot set user id: Resource temporarily unavailable”处理及limits.conf说明
一.背景介绍及问题处理 应用报账号不能ssh到主机,首先怀疑是防火墙或hosts.deny限制但查看之下并没有:接着使用其提供的账号密码确实不能登录,怀疑是密码被修改(有个和平时不太一样现像是输入密码 ...
- su: cannot set user id: Resource temporarily unavailable【转】
今天R&D所在主机出现su: cannot set user id: Resource temporarily unavailable资源不可用报错,直接通过其他机器ssh huyuh@xxx ...
- su切换用户报错cannot set user id: Resource temporarily unavailable
su: cannot set user id: 资源暂时不可用 登录root su - tomcat 报错: cannot set user id: Resource temporarily un ...
- ssh连接报错Write failed: Broken pipe Resource temporarily unavailable
问题描述 使用root连接服务器正常,切换普通用户连接报错 具体报错如下:Write failed: Broken pipe 或者:failed to execute /bin/bash: Resou ...
- error=11, Resource temporarily unavailable
问题1:Cannot run program "/bin/ls": error=11, Resource temporarily unavailable 1 15/04/22 14 ...
- -bash: fork: retry: Resource temporarily unavailable;centos6.5
Last login: Wed Jun 18 14:04:11 2014 from 1.1.1.135 -bash: fork: retry: Resource temporarily unavail ...
- failed to execute /bin/bash: Resource temporarily unavailable的问题处理
[admin@localhost ~]$ sudo su - scloanLast login: Tue Jun 12 14:06:31 CST 2018 on pts/3su: failed to ...
- -bash: fork: retry: Resource temporarily unavailable
登陆不了服务器The server refused to start a shell. 登陆服务器后执行ls命令报错: 1 2 $ls -bash: fork: retry: Resource t ...
随机推荐
- Java热部署相关
今天发现早年在大象笔记中写的一篇笔记,之前放在ijavaboy上的,现在它已经访问不了了.前几天又有同事在讨论这个问题.这里拿来分享一下. 在web应用开发或者游戏服务器开发的过程中,我们时时刻刻都在 ...
- 俞敏洪:我创业24年感悟的3条CEO守则
转自:http://www.gamelook.com.cn/2017/10/306603 创业24年,他的创业经历被拍成了电影.在一次小范围聚会时,他说现实远比剧本要精彩.“如果让我一切从头开始,我会 ...
- Centos 7 下, 安装odoo 10
1. Centos在虚拟机中, 最小化安装, 网络连接选择的是 桥接模式, 安装完成后, 是不能直接上网的, 输入root 和密码, 登录进去, 然后执行: [root@localhost ~]# v ...
- Java开发各层对象专用名词含义 PO,VO,DAO,BO,DTO,POJO, BYO,Entity,JavaBean,JavaBeans
Java的几种名词(PO,VO,DAO,BO,POJO)解释 PO:persistant object 持久对象.可以看成是与数据库中的表相映射的java对象.最简单的PO就是对应数据库中某个表中的一 ...
- 2018-7-23到quectel报道
以后和quectel产品相关的技术都会用这个blog来记录
- Django中的ORM介绍,字段以及字段的参数。
Object Relational Mapping(ORM) ORM介绍 ORM概念 对象关系映射(Object Relational Mapping,简称ORM)模式是一种为了解决面向对象与关系数据 ...
- linux安装phpstorm
1.下载phpStorm安装包,下载地址:https://download.jetbrains.8686c.com/webide/PhpStorm-2018.3.1.tar.gz 2.解压到/usr/ ...
- Python——列表深浅拷贝
一.深浅拷贝 如果希望将列表复制一份,通过列表的内置方法copy就可以实现: s = [[1,2],3,4] s1 = s.copy() print(s) print(s1) 拷贝出的列表s1与原列表 ...
- 操作MySQL
1修改MySQL表结构数据类型:ALTER TABLE 表名 MODIFY 字段名 VARCHAR(50); 2.删除表:DROP TABLE 表名: 3.now() 日期时间函数 4.sysdate ...
- 17.scrapy-splash安装-2
scrapy-splash是一个scrapy中支持的javascript渲染的工具. scrapy-splash安装分为两部分.一个是splash服务的安装,具体是通过docker,安装之后,会启动一 ...