Operating System - Linux
1752728 Members
5913 Online
108789 Solutions
New Discussion юеВ

Re: Unable to set ulimit for a user in Red Hat ES 5.

 
SOLVED
Go to solution
mpua
Frequent Advisor

Unable to set ulimit for a user in Red Hat ES 5.

Hi,

I've set a nofiles hard limit in /etc/security/limits.conf this way:

* hard nofiles 8192

Then, I put the following setence in .bash_profile of user "carlos":

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

ulimit -n 8192


When I log as carlos from root (su - carlos) my user carlos sets the ulimit correctly as 8192 but when I log straight as carlos through SSH my user ends with nofiles ulimit as 1024, giving me the following error trying to execute the "ulimit -n 8192" line:

bash: ulimit: open files: cannot modify limit: Operation not permitted


Whats the point with this??? Im turning crazy.
2 REPLIES 2
Matti_Kurkela
Honored Contributor
Solution

Re: Unable to set ulimit for a user in Red Hat ES 5.

Your SSH daemon has been started using the old ulimit values, so all child processes of sshd will inherit the old values.

Only root has the special privilege to increase a hard ulimit... and apparently the main sshd process gives up this privilege for security, so the old ulimit can be increased only if the new SSH session logs in as root.

After increasing the hard ulimit, restart the sshd daemon using a session that already has the new hard limit. (Rebooting the system would work too, but it's overkill...)

MK
MK
mpua
Frequent Advisor

Re: Unable to set ulimit for a user in Red Hat ES 5.

Thanks so much, Matti! That worked :-).