1830256 Members
2030 Online
110000 Solutions
New Discussion

Re: ulimt question

 
joseph wholey
Regular Advisor

ulimt question

RHEL 4. I'm trying to set the ulimit for open files (ulimit -n) on one of my RHEL servers from the default to 66536. I put the value in my /etc/sysctl.conf as follows:
fs.file-max = 65536.

However, when I log in as root or any other user, it is set to the default value of 1024. Why is that?
8 REPLIES 8
Alexander Chuzhoy
Honored Contributor

Re: ulimt question

ulimit is to be set in files that control your shell. For example for all users on the system that use bash edit /etc/bashrc.
ulimit -n number
In /etc/sysctl.conf file your define kernel tunnings.
sandeep_raman
Honored Contributor
George Liu_4
Trusted Contributor

Re: ulimt question

There should no trailing dot (.) after 65536.
BTW, default file-max is 102043 on RHEL4. Can you get the output of

cat /proc/sys/fs/file-max

joseph wholey
Regular Advisor

Re: ulimt question

Thanks for all of the responses... one remaining question... why when I issue "ulimit -n" I get 1024, but when I look in /proc/sys/fs/file-max, it's set to what I have in /etc/sysctl.conf. What is ulimit -n showing me, and where is it picking up the value?
Jorge Cocomess
Super Advisor

Re: ulimt question

Joseph,

Just a quick clarification, Max-File and Ulimit are two different parameters.

Max-file:
file-max is a system level maximum number of file handles that the system will allocate. The cumulative number across all jobs cannot exceed that.

Ulimit:
ulimit sets the limit for the process itself. So for a telnet session, ulimit can be used to set the soft limit up or down for a particular resource for that telnet session and its child processes. (And ulimit can set the hard limit down, but not up).

The only paramter that you should worry about is the limits.conf and add the user that you'd like to have the ulimit increased (/etc/security/limits.conf).
Once you done that, restart the sshd service. Have the user log back in and do this command ulimit -a

Let me know if you need more details on this.

Jorge
joseph wholey
Regular Advisor

Re: ulimt question

Jorge,

I did exactly as you specified... updated the /etc/security/limits.conf as follows:

usr hard nofile 65536

recycled the sshd daemon, logged out, logged back in as 'usr', issued ulimit -a, and open files still has the value of 1024.
Jorge Cocomess
Super Advisor

Re: ulimt question

How much memory do you have on your box?

What's your setting for max-file?
What's your limits.conf file look like now?

Please give me these details and I will try to help you.

Jorge
Mike Stroyan
Honored Contributor

Re: ulimt question

The limits setting in /etc/security/limits.conf is done by a PAM login. You need to have a "UsePAM yes" line in /etc/ssh/sshd_config in order to tell sshd to use PAM. Without that the limits.conf setting will be ignored for ssh logins.
You should look through "man sshd_config" to see that you are getting the behavior you want from sshd and PAM after making this change.