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 ...
随机推荐
- vue 绑定属性 绑定Class 绑定style
<template> <div id="app"> <h2>{{msg}}</h2> <br> <div v-bi ...
- .net core批量注入实现类
1.获取实现类程序集方法 public class RuntimeHelper { //通过程序集的名称加载程序集 public static Assembly GetAssemblyByName(s ...
- Anaconda(python3.6)中使用python2.7
因为我现在安装的是最新版Anaconda3,其自带的Python版本为3.6,如果我们需要添加2.7版本的Python,可以进行如下操作.(同理,如果有人安装的是Anaconda2需要添加Python ...
- String,StringBuilder和StringBuffer区别
String字符串常量 StringBuilder 字符串变量(非线程安全) StringBuffer 字符串变量(线程安全) 1.String String是字符串常量,为不可改变对象 Strin ...
- JSP:注册&登录
数据库:Mysql 除了_id自动增长,其余全是varchar 注册:register.jsp <%@ page language="java" import="j ...
- Spark2.X集群运行模式
rn 启动 先把这三个文件的名字改一下 配置slaves 配置spark-env.sh export JAVA_HOME=/opt/modules/jdk1..0_60 export SCALA_HO ...
- echarts学习之——电力迁徙图
今天主要就是在搞echarts,我们都知道他为我们提供了丰富的api方法,使我们能够迅速的搭建图标.同时他里面还有许多的案例, 其中就有这么一个国内航线模拟迁徙的地图,如下所示: 而我们通常因为各种需 ...
- NodeJS + React + Webpack + Echarts
最近画了个简单的前端图,使用百度的echarts,基于原来项目的NodeJS+React+Webpack框架.在此记录一下: 1. 在react里封装echarts组件,并调用后端API. (参考的 ...
- asp.net Log4Net错误日志个人总结
1)创建Global.asax protected void Application_Start(object sender, EventArgs e) { log4net.Config.XmlCon ...
- xsync
shell 小工具,用于集群搭建: xsync脚本基于rsync工具,rsync 远程同步工具,主要用于备份和镜像.具有速度快.避免复制相同内容和支持符号链接的优点,它只是拷贝文件不同的部分,因而减 ...