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 ...
随机推荐
- C#语言时间
string x = "abcdefg"; 定义字符串 int length = x.Length; 定义长度 string y = x.Substring(1, 2); 意思的从 ...
- 删除n天前的所有目录和文件
删除目录 find /your_dir/ -maxdepth -type d -mtime + -exec rm -rf {} \; 删除文件 find /目录/ -mtime + -name &qu ...
- jmeter获取token并请求失败Internal authentication failed 400
jmeter访问token报错400 1.请求token地址 2.运行jmeter报错-run 3.400的意思是: 400(错误请求) 服务器不理解请求的语法. 4.报错信息如下 {"er ...
- 函数的嵌套+nonlocal和global关键字(重点)
1.在函数中声明函数 在内部函数中使用变量的时候, 查找顺序: 先找自己 -> 上一层 -> 上一层..全局 -> 内置 # 函数的互相调用 # def func1(): # pri ...
- Oracle 更改字符集 更改后之前的中文全成乱码了
安装时采用什么字符集主要看你的需求,一般测试用的话,就用UTF8.后面可以修改, 10g:UTF8 到ZHS16GBK SHUTDOWN IMMEDIATE; STARTUP MOUNT ; ALTE ...
- [Android] android.util.Log
android.util.Log常用的方法有以下5个:Log.v() Log.d() Log.i() Log.w() 以及 Log.e() .根据首字母对应VERBOSE,DEBUG,INFO, W ...
- Wed Jul 04 18:01:38 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended
Wed Jul 04 18:01:38 CST 2018 WARN: Establishing SSL connection without server's identity verificatio ...
- Jenkins 之邮件配置
Jenkins 之邮件配置其实还是有些麻烦的,坑比较多,一不小心就...我是走了很多弯路的. 这里记录下来,希望大家以后不要重蹈覆辙: 我测试过,这里的 Extended E-mail Notific ...
- snmp安装,及测试
https://www.cnblogs.com/xdp-gacl/p/4016524.html
- Kubernetes中pod创建流程
转自:https://blog.csdn.net/yan234280533/article/details/72567261 Pod是Kubernetes中最基本的部署调度单元,可以包含contain ...