SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I've spent a fair amount of time googling this one - many of the answers were here on LQ - but they don't appear to be working for me.
I need to increase the number of open files for a "user" on a server.
Some of what I've tried:
1) Added
ulimit -n 9999
to /etc/profile
But then I get:
-bash: ulimit: open files: cannot modify limit: Operation not permitted
2) I also created a /etc/limits file with an entry like:
user N9999U9999
which doesn't appear to work either.
3) Also played with various incantations of ulimit w/ hard or soft limits from the command line.
I'm ssh'ing into the system and have confirmed that /etc/ssh/sshd_config has UsePrivilegeSeparation commented out. (Or does that have to be uncommented and set to no?)
This is for a service/daemon that runs as a specific user. So in a way I'm not even sure how I check that the running service is getting the privileges I'd like it to have - since it gets started from rc.local.
When I do ulimit -a after all of these tests, I see:
open files (-n) 1024
Any suggestions? This is a home-installed (my own install script) 10.2 w/ my own 2.6 kernel.
Thanks,
Eric
You were correct adding an entry to /etc/limits. What you have done is set the max number of open files to 9999 and the max number of processes to 9999 for the user called 'user'. The settings are per login - they are neither global nor permanent.
For your sshd_config file, all the values shown commented out are the default values that sshd runs with. To change the value being used, you will have to uncomment it and set it to no.
I get similar behaviour using ssh here. If I ssh directly as an account with elevated limits, those limits aren't set correctly. If I ssh as another user (not root, I can't login as root via ssh), then su to the account with the elevated limits, the limits are set. It looks like ssh ignores the /etc/limits settings.
There are quite a few sites that recommend turning off UsePrivilegeSeparation to get this working, but I haven't tested it because doing this on an internet accessible host is not a good thing. If your box is only accessible on a trusted network though...
Thanks Steve,
it looks like it is working now. I tweaked the start up to be:
su - user -c 'ulimit -n > /tmp/maxfiles ; /home/user/bin/<script> &'
and I can now confirm that it works okay when started from rc.local as well as from ssh.
-Eric
Do'h, I was wrong - it isn't working correct. The /tmp/maxfiles (see my previous post) is showing 1024 after a reboot. Anyone have any other suggestions?
I also tried
echo 9999 > /proc/sys/fs/file-max
in the etc/rc.d/rc.local before the su - user -c part gets run.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.