Sunday, May 3, 2009

Changing ulimit in linux

For each ulimit variable, there are actually two limits: a soft limit and a hard limit.

A normal user can adjust the soft limit freely in the range of 0....
A normal user can adjust the hard limit too, but can only decrease it. You must be root to increase the hard limit from its default value.

To see the hard limit values, run "ulimit -H -a".

The limit values are inherited from the parent process to the child process: you could add the command to increase the hard limit to the sshd startup script, so that sshd and all sessions started through it will inherit the increased hard limit. After that, you should be able to increase the soft limit as a normal user.

Alternatively, some Linux distributions have PAM modules (pam_limit.so) that can adjust the limit values at login time, if configured to do so.

Also following can be tried to know the current limits:

sysctl -a|grep fs.file-max

if the parameter is >= 16384 than you can set like this other wise you need to change the kernel parameter.

No comments:

Post a Comment