Link to home
Start Free TrialLog in
Avatar of RamusNee

asked on

Making ulimit default value permanent without calling ulimit

I modified /etc/security/limits.conf. I can manually raise the number of file descriptors using ulimit -n. I can put that command in /etc/profile or similar.

How can I avoid /etc/profile or similar shell modifications and just have ulimit -n show the right limit from the start?

# fgrep nofile /etc/security/limits.conf
*                -       nofile          16384

# egrep '__FD_SETSIZE.*16384' /usr/include/*/*h
/usr/include/bits/typesizes.h:#define   __FD_SETSIZE            16384
/usr/include/linux/posix_types.h:#define __FD_SETSIZE   16384

# fgrep pam_limits /etc/pam.d/*
/etc/pam.d/atd:session    required
/etc/pam.d/cron:session    required
/etc/pam.d/login:session    required
/etc/pam.d/login:session    required   /lib/security/
/etc/pam.d/ssh:session    required
/etc/pam.d/ssh:session    required   /lib/security/
/etc/pam.d/su:session    required

# uname -a
Linux clt 2.6.22-14-generic #1 SMP Tue Feb 12 07:00:00 UTC 2008 i686 GNU/Linux

The first two changes above were enough to raise the limit permanently on Ubuntu Dapper, but I cannot find a way to do that (without shell)  on Gutsy.

I login as root via ssh, but that should not matter.

Thank you.
Avatar of favoretti
Flag of Netherlands image

You should change your lines into:

* soft nofile 16384
* hard nofile 16384

Otherwise I think it assumes a "top" and doesn't adjust the defaults.
Avatar of RamusNee

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One thing that comes to mind... Do you have any other lines that set nofile in limits.conf before the * rule?
Avatar of RamusNee


No just the pasted line(s). I have no idea why * does not match root.