Different values returned by ulimit -r

为君一笑 提交于 2019-12-10 14:34:46

问题


I added to my system-wide /etc/security/limits.conf the following two rows:

*       soft    rtprio      55
*       hard    rtprio      55

After a system reboot, I get two different results according to the way I access my user account on the machine.

user@client# ssh user@server

user@server# ulimit -r
55

Then I logout and login again as root

user@client# ssh root@server

root@server# su - user
user@server# ulimit -r
0

I have no special settings neither in .bashrc nor in any other places, or, at least, I think so.

Why is this happening?


回答1:


You must look at the PAM configuration of ssh and su. I suppose that they are not the same.

For example at my system:

$ grep limit /etc/pam.d/su
# Sets up user limits, please uncomment and read /etc/security/limits.conf
# (Replaces the use of /etc/limits in old login)
# session    required   pam_limits.so

$ grep limit /etc/pam.d/sshd
# access limits that are hard to express in sshd_config.
# Set up user limits from /etc/security/limits.conf.
session    required     pam_limits.so

As you can see in one of the cases the pam_limits line is commented. I suppose that you have something like this also.



来源:https://stackoverflow.com/questions/11291307/different-values-returned-by-ulimit-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!