Hi,
I'm trying to remove any limit on open files for a user; I've set username nofiles to unlimited in /etc/security/logins.conf, but now I get "could not open session" if I try to su to the user.
singhh - nofile unlimited
I think this is related to PAM, so I've modifed /etc/pam.d/su and /etc/pam.d/login to use pam_limits.so:
# cat /etc/pam.d/su #%PAM-1.0 auth sufficient pam_rootok.so # Uncomment the following line to implicitly trust users in the "wheel" group. #auth sufficient pam_wheel.so trust use_uid # Uncomment the following line to require a user to be in the "wheel" group. #auth required pam_wheel.so use_uid auth include system-auth account sufficient pam_succeed_if.so uid = 0 use_uid quiet account include system-auth password include system-auth session required pam_limits.so session include system-auth session optional pam_xauth.so
# cat /etc/pam.d/login #%PAM-1.0 auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so auth include system-auth account required pam_nologin.so account include system-auth password include system-auth # pam_selinux.so close should be the first session rule session required pam_selinux.so close session include system-auth session required pam_loginuid.so session optional pam_console.so # pam_selinux.so open should only be followed by sessions to be executed in the user context session required pam_selinux.so pam_limits.so open session optional pam_keyinit.so force revoke
What am I doing wrong?
S.
From: Stephen Nelson-Smith stephen@atalanta-systems.com
I'm trying to remove any limit on open files for a user; I've set username nofiles to unlimited in /etc/security/logins.conf, but now I get "could not open session" if I try to su to the user. singhh - nofile unlimited
Don't you mean /etc/security/limits.conf ?
JD
2009/12/8 John Doe jdmls@yahoo.com:
From: Stephen Nelson-Smith stephen@atalanta-systems.com
I'm trying to remove any limit on open files for a user; I've set username nofiles to unlimited in /etc/security/logins.conf, but now I get "could not open session" if I try to su to the user. singhh - nofile unlimited
Don't you mean /etc/security/limits.conf ?
Yeah... duh :-O
S.
On Tue, Dec 8, 2009 at 11:02 AM, John Doe jdmls@yahoo.com wrote:
From: Stephen Nelson-Smith stephen@atalanta-systems.com
I'm trying to remove any limit on open files for a user; I've set username nofiles to unlimited in /etc/security/logins.conf, but now I get "could not open session" if I try to su to the user. singhh - nofile unlimited
Don't you mean /etc/security/limits.conf ?
OK, I went searching the list archives on this one and found this, and tried it.
And now I can no longer log into the Centos 5.4 box. Even on the console.
Not a big deal since this is a VM running in my sandbox so I can blow it away no problem.
But how do I increase my ulimit to unlimited?
I put in that file
* - nofile unlimited
and then rebooted the box
And can no longer log in
OK, I just found this
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=13144
Which says that you cannot use "unlimited" for nofile
It says to do this
* soft nofile 63536 * hard nofile 63536
or "more realistically" to do this :
* soft nofile 8192 * hard nofile 63536
But I still cannot find what is the difference between the hard and soft limit
Also, once this file has been changed, does the system need to be rebooted for it to take affect?
Or does it automatically take affect for any new processes? So just restart any service I want to take advantage of it?
thanks, -Alan
Sorry for the frequent updates - but I also found this :
http://gnufreakz.wordpress.com/2009/08/12/increase-ulimit-in-centos/
which talks about setting
“fs.file-max = 65536″
in sysctl.conf
Does it have to be set in both sysctl.conf and the /etc/security/limits.conf?
If so, why?
thanks, -Alan
Stephen Nelson-Smith wrote:
Hi,
I'm trying to remove any limit on open files for a user; I've set username nofiles to unlimited in /etc/security/logins.conf, but now I get "could not open session" if I try to su to the user.
singhh - nofile unlimited
I think that is an invalid config, just set the limit to something really high
# ulimit -n unlimited -bash: ulimit: open files: cannot modify limit: Operation not permitted
Looks like somewhere around the 1 million mark is the max, can't imagine why anyone would have a system that would have so many files open.. The max I allow any user is 10,000 which seems reasonable.
nate