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 ...
随机推荐
- synchronous-request-with-websockets
https://stackoverflow.com/questions/13417000/synchronous-request-with-websockets
- (转)MTU&MSS
MTU是Maximum Transmission Unit的缩写,意为最大传输单元,通俗的理解就是在网络上传送的最大数据包,单位是字节. 以太网对数据帧的长度都有一个限制,其最大值为1500,这个特性 ...
- TensorFlow安装教程(ubuntu 18.04)
此教程的硬件条件: 1.Nvidia GPU Geforce390及以上 2.Ubuntu 18.04操作系统 3.Anaconda工具包 如果python版本为3.7及以上,使用如下命令降级到3.6 ...
- hive on spark的坑
原文地址:http://www.cnblogs.com/breg/p/5552342.html 装了一个多星期的hive on spark 遇到了许多坑.还是写一篇随笔,免得以后自己忘记了.同事也给我 ...
- 解决linux更新apt软件源时报出GPG错误
今天给树莓派换源,爆出N个这错误: W: GPG error: http://mirrors.neusoft.edu.cn/raspbian/raspbian wheezy InRelease: Th ...
- tips:Java的Random类和Random函数
tips:Java的Random类和Random函数! 随机数是一个很有趣的东西,在java中可以通过下面这2种方法得到: (1)Random类: Random类是java.util.Random这个 ...
- CS229 6.10 Neurons Networks implements of softmax regression
softmax可以看做只有输入和输出的Neurons Networks,如下图: 其参数数量为k*(n+1) ,但在本实现中没有加入截距项,所以参数为k*n的矩阵. 对损失函数J(θ)的形式有: 算法 ...
- PHP获取中文首字母的函数
PHP获取中文首字母的函数 <?php header("Content-type: text/html; charset=utf-8"); function getFirst ...
- 20.多线程.join()和setDaemon()的使用
1.join()方法 join ()方法:主线程A中,创建了子线程B,并且在主线程A中调用了B.join(),那么,主线程A会在调用的地方等待,直到子线程B完成操作后,才可以接着往下执行,那么在调用这 ...
- 《算法》第三章部分程序 part 4
▶ 书中第三章部分程序,加上自己补充的代码,包括散列表.线性探查表 ● 散列表 package package01; import edu.princeton.cs.algs4.Queue; impo ...