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?
Use the ulimit command with the -a option to see a list of all your user's limits on the system, or just ulimit by itself to see a quick summary. To limit the max number of processes that a user can spawn, use the -u option.
New processes will inherit the ulimits of the parent process. The ulimit command is specific to each terminal. The arguments are not the same from bash to sh to zsh. Keep this in mind when changing init scripts for daemons.
The stack size limit is the maximum size of the stack for a process, in units of 1024 bytes. The stack is a per-thread resource that has unlimited hard and soft limits.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With