Operating System - Linux
1828959 Members
2656 Online
109986 Solutions
New Discussion

how i set the max files number for user?

 
STL
Occasional Advisor

how i set the max files number for user?

how i set the max files number for user?

what is the different of:

/etc/security/limits.conf
hard nofile numberA
soft nofile numberB

more /proc/sys/fs/file-max

and use the command
ulimit -u number -n number
in the .bash_profile


????

i am confuse, please help me!!!


5 REPLIES 5
Ivan Ferreira
Honored Contributor

Re: how i set the max files number for user?

The /proc/sys/fs/file-max is the maximum number of open files for all the system (all users and applications).

You can use /etc/security/limits.conf establish the maximum limits for users or groups.

The ulimit command can be used to modify these values but never larger to the established on the limits.conf file, only root can raise the limits. So, use /etc/security/limits.conf to configure the limits for users.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Vitaly Karasik_1
Honored Contributor

Re: how i set the max files number for user?

1) /etc/security/limits.conf
hard nofile numberA
soft nofile numberB

are the limits that you should use - there are hard and soft limits per user/group.

2)
more /proc/sys/fs/file-max
is a per system limit - e.g. for all processes

3)
and use the command
ulimit -u number -n number
in the .bash_profile
With this command regular user can increase his limit, but only up to his hard limit
There is setrlimit() system call that do the same thing.

Steven E. Protter
Exalted Contributor

Re: how i set the max files number for user?

Shalom,

I've never heard of limits.conf, but please tell us what distribution of Linux we're talking about here.

ulimit and kernel parameters can control max files per user. There are two limtits to look at. Overall limits for the system and for any one user.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vipulinux
Respected Contributor

Re: how i set the max files number for user?

Hi

You can do it by enabling quota on the file system.
Once that is done use the edquota command to set the max no. of inodes that a user can have. ( as each file has an inode if you specify max indoes as 100 the user will be able to make only 100 files)

Cheers
STL
Occasional Advisor

Re: how i set the max files number for user?

ulimit -n 10000, set number of open files to 10000, default is 1024.

but, where i set the default???