[Centos] permanent ulimit -n on CentOS 3.4

Thu Feb 24 03:39:45 UTC 2005
Barry Brimer <barry.brimer at bigfoot.com>

Quoting "C. Linus Hicks" <lhicks at nc.rr.com>:

> On Wed, 2005-02-23 at 21:50 -0500, Mike Obvious wrote:
> > Hi!
> >
> > Question from the novice.
> >
> > I have to permanently increase number of opened files ( ulimit -n 16384 and
> > ulimit -Hn 16384) for some application.
> > I did custom kernel based on
> >
> >
>
https://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/sysadmin-guide/s1-custom-kernel-modularized.html
> >
> > and application documentation ( written for RH 9), no error during all
> makes
> > but I have panic during the boot. ( It's Dell SC1425, dual CPU, 2GB RAM,
> > i686-based kernel).
> >
> > Is there any other way to do it ?
>
> Look in /etc/security/limits.conf

To keep number of opened files at 16384 do the following

Append this to your /etc/security/limits.conf
====================
* soft nofiles 16384
* soft nofiles 16384
====================
Append this to your /etc/sysctl.conf
===================
fs.file-max = 16384
===================
Type sysctl -p to reread your sysctl.conf file.  This will also syntax check
your sysctl.conf file for you.

Log out, and log back in to complete this task and reread your environment with
the new settings.

Important note: Centos 3.x uses a privelege separated sshd by default.  You can
disable this functionality if needed in /etc/ssh/sshd_config.  Basically, sshd
runs as the user connecting to it, instead of root.  Since root is the only
user who can change ulimit settings, you will be unable set ulimit settings as
an unprivelged user in an ssh session.  The way to test this is to make the
changes above and log in at the console.  Typing ulimit -n should work
correctly.  If you ssh to the server, and type ulimit -n it will show the
default (probably 1024).  If you su - user and then type ulimit -n it should
show the correct number (16384)

Hope this helps.

Barry