raising ulimit -n value in slackware

Has anybody been able to raise the ulimit -n value for a user on a slackware box? It's an easy change on redhat and some other distros with /etc/security/limits.conf, but slackware does not have this file, so maybe someone here can help with this?

thanks in advance
HiT5698Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wesly_chenCommented:
Hi,

   How about
# limit <variable> unlimited
which <variable> is one of stacksize, coredumpsize, datasize, etc.

   limit is shell built-in command. It works for csh/tcsh/sh/bash.

Wesly
0
wesly_chenCommented:
Or
# limit <variable> <value>

Wesly
0
ITG-SSNACommented:
You should man ulimit.

The command is ulimit and the number of files.

For example

ulimit unlimted

will give unlimited file handles.

ulimi -n 16356
( break the out of the OS limit for things like Eggdrop etc.)

Hope this helps,

~K Black
Irvine, Ca.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

HiT5698Author Commented:
thanks for the replies so far guys

I looked at the limit bash builtin, but I'd rather change the max# of open file descriptors without using a shell script to set it. Also, if a user changes their shell, the limit would be back at 1024 again.

Ulimit does indeed work, but the settings are not kept between login sessions (if you log out, the limit goes back to 1024 when you log back in)

So if I can get ulimit to retain it's settings between login sessions, that might be the way to go, but I also have another question regarding ulimit (the manpage wasn't very helpful about this):

Can ulimit be used to change the settings of a user other than the current one? I'm I'm root, I can do ulimit -n 2048 to raise the max file descriptors for the root account, but I'm not sure how to change the ulimit of another user.
0
wesly_chenCommented:
Hi,

> if a user changes their shell, the limit would be back at 1024 again
>  settings are not kept between login sessions
You can put "ulimit" or "limit" in .bashrc, .proifile or .cshrc.
For system wide, you can put "ulimit" or "limit" in
/etc/bashrc, /etc/profile, /etc/csh.cshrc and /etc/csh.login
so every user can have the ulimit setting by default (unless they change their own).

> rather change the max# of open file descriptors without using a shell script to set it
Well, limit/ulimit is set by the shell. So you need to do it with shell.

> how to change the ulimit of another user
Change another user's .profile or .login because it is set within the shell. Different shell session may have different limit setting.

Wesly
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HiT5698Author Commented:
Hello again:

I tried adding "ulimit -n 2048" (without the quotes) to the system-wide /etc/profile, and also I tried adding it to ~/.bashrc, but the limit does not get set when a user logs in. I also tried adding "limit nofile 2048" in both of those files too, but with no luck there either. Any ideas what I might be doing wrong?

0
HiT5698Author Commented:
It seems that the change to /etc/profile or also ~/.bashrc does work, but if the user who logs in does not have root priviledges, this message is shown when they login:

-bash: ulimit: open files: cannot modify limit: Operation not permitted
0
wesly_chenCommented:
> bash: ulimit: open files: cannot modify limit: Operation not permitted
I try "ulimit -n 512" in ~/.bashrc with regular user account and it works.

I think "1024" is the upper bond of descriptor for regular user.

>  /etc/profile or also ~/.bashrc does work
Is the default shell bash?

Wesly
0
HiT5698Author Commented:
Yes I use bash for the default shell. And yes it works if I put "ulimit -n num_below_1024" in /etc/profile and ~/.bashrc, its because a user can lower their file limit if they want to, but they cannot raise it (unless they are root). But I need to be able to set a limit well above 1024 for users (2048 for some users).

It's driving me nuts, because this is such an easy thing to do with redhat and some other distros, but why not with slackware :(
0
wesly_chenCommented:
I can't raise to 2048 for the regular user in Redhat Linux. How did you do that?
Wesly
0
ITG-SSNACommented:
Try adding the ulimit settings to /etc/bashrc at the very end.

You should of course, back up the file first ;)

~KB
0
ITG-SSNACommented:
Also do notice that the other part of your question is related to the /etc/profile setting...here's what mine looks like:

/etc/profile:[ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1

~KB
0
ITG-SSNACommented:
SOrry for the multiple posts guys, I just forgot to add, beware of ulimit to some degree. Test it first on the settings. And I strongly suggest doing the math on the number of files you can bear in memory, there should be some good resources for this in the online guides for tweaking Linux.

It's possible for ulimit to panic a production system, and can cause some fairly unrecongnizable side effects on the system, so I strongly recommend you consider why you want to raise the default limits (where were there for sanity reasons mostly)

Regards,

~K Black
0
HiT5698Author Commented:
Well I need to have more than 1024 descriptors, so I can run an ircd with more than 1024 users

>  I can't raise to 2048 for the regular user in Redhat Linux. How did you do that?

With redhat (and any distro with /etc/security/limits.conf) it's real easy, just add these 2 lines in that file for each user you want to give more fd's to:

username hard nofile 3072
username soft nofile 3072

Then after that user logs back in, they'd be able to use 3072 file descriptors, and no other changes are needed. Why oh why doesn't slackware have this option.. I even went so far as tried to create that file on my slackware box, but it doesn't get read..

Anyway thanks for all the input guys, you've both been helpful ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.