Slackware This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-25-2006, 02:18 PM
|
#1
|
LQ Newbie
Registered: Jan 2006
Location: Northern CA
Distribution: Slackware
Posts: 12
Rep:
|
Setting ulimit to increase # of open files
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
|
|
|
01-25-2006, 02:36 PM
|
#2
|
LQ Newbie
Registered: Jan 2006
Location: Northern CA
Distribution: Slackware
Posts: 12
Original Poster
Rep:
|
More odd information . . .
Logged in as "user", ulimit -n gives 1024
But as root if I run
su user -c "exec /bin/bash -l -c \"ulimit -n\""
I get 9999
|
|
|
01-25-2006, 03:23 PM
|
#3
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep:
|
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...
|
|
|
01-25-2006, 04:50 PM
|
#4
|
LQ Newbie
Registered: Jan 2006
Location: Northern CA
Distribution: Slackware
Posts: 12
Original Poster
Rep:
|
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
|
|
|
01-31-2006, 07:43 PM
|
#5
|
LQ Newbie
Registered: Jan 2006
Location: Northern CA
Distribution: Slackware
Posts: 12
Original Poster
Rep:
|
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.
Argh.
|
|
|
02-01-2006, 03:42 AM
|
#7
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep:
|
I came in late again...
That's interesting about initscript - I hadn't thought of it at all
|
|
|
All times are GMT -5. The time now is 04:19 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|