Operating System - Linux
1748066 Members
5397 Online
108758 Solutions
New Discussion юеВ

Re: increase file descriptor

 
Ragni Singh
Super Advisor

increase file descriptor

Hi all,

I was trying to increase the file descriptor to 465305. The default one is 1024.

I ran limit -n 465305 and then edited /etc/security/limits.conf to include the following line
* hard nofile 465305.

But a few days later, the limit -n showed the
default value again. Did I miss anything?

Thanks and points will be assigned.
6 REPLIES 6
Ivan Ferreira
Honored Contributor

Re: increase file descriptor

Try setting:

* soft nofile 465305
* hard nofile 465305

You must logout and login again.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ragni Singh
Super Advisor

Re: increase file descriptor

Sorry Ivan, it doesn't look like its working. Any other ideas?
Ivan Ferreira
Honored Contributor

Re: increase file descriptor

How are you logging in? That is, maybe the pam configuration is not correct, for example, /etc/pam.d/ssh and /etc/pam.d/login, both, should have the pam_limits pam module enabled, or both point to system-auth and system-auth have the pam_limits pam module enabled in the session management group.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ragni Singh
Super Advisor

Re: increase file descriptor

Here are what the entries currently look like..

/etc/security/limits.conf

#
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
* hard nofile 465305
* soft nofile 465305


I have logged out and logged back in..

ulimit -n
1024


/etc/pam.d/login

#%PAM-1.0
auth required pam_securetty.so
auth required pam_stack.so service=system-auth
auth required pam_nologin.so
account required pam_stack.so service=system-auth
password required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth
session optional pam_console.so



/etc/pam.d/sshd


#%PAM-1.0
auth required pam_stack.so service=system-auth
auth required pam_nologin.so
account required pam_stack.so service=system-auth
password required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth
session required pam_limits.so
session optional pam_console.so


Ivan Ferreira
Honored Contributor

Re: increase file descriptor

I think that if you login via SSH the limits should be imposed, and if you login locally, it should not.

Please add:

session required pam_limits.so

To the /etc/pam.d/login file before the optional pam_console.so, as in sshd.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
skt_skt
Honored Contributor

Re: increase file descriptor

# ulimit -n
1048576

# cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#
#
#Where:
# can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
#
# can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
# can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
#
#
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
* soft nofile 1048576
* hard nofile 1048576
# End of file
adedla63p:root [/usr/share/doc]
# cat /etc/security/limits.conf|grep file
# - core - limits the core file size (KB)
# - fsize - maximum filesize (KB)
# - nofile - max number of open files
# - locks - max number of file locks the user can hold
* soft nofile 1048576
* hard nofile 1048576
# End of file


"ulimit -n" resturns same value on both ssh and telnet connections