From: Vadkan Jozsef on
so the question still is: how can I set ulimit to be permanent? e.g.:
10240 after reboot? :D

there's no way for it?:O

On k, 2010-01-26 at 15:42 -0500, Stephen Powell wrote:
> On 2010-01-26 at 14:40:23 -0500, Alex Samad wrote:
> > have a look at /etc/security/limits.conf
> >
> > I have 2 lines in there that are not commented
> >
> > @user hard nofile 2048
> > alex hard nofile 4198
>
> That works! I modified my /etc/security/limits.conf file and added the following entry:
>
> * hard nofile 1048
>
> I then shutdown and rebooted.
>
> I login as a normal user and issue
>
> $ ulimit -n
> 1024
> $ ulimit -n 1048
> $ ulimit -n
> 1048
> $ ulimit -n 2000
> -bash: ulimit: open files: cannot modifiy limit: Operation not permitted
>
> The limit starts at the default of 1024, just as before. But ordinary users can raise it
> up to and including the new hard limit of 1048. But they cannot raise it above that.
> To raise it above the hard limit you must be root.
>
> Thanks, Alex!
>
>



--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
From: Stephen Powell on
On 2010-01-26 at 15:53:37 -0500, Vadkan Jozsef wrote:
> so the question still is: how can I set ulimit to be permanent? e.g.:
> 10240 after reboot? :D
>
> there's no way for it?:O

I believe that Alex and I just told you, in effect.
But if you need detailed instructions, OK. :-(

First of all, it depends on whether you want this limit changed for
all users, all users of a group, or just one user, such as a database
server's userid. I'll give you an example for a single user.
I hope you can adapt these instructions if that's not the case.
Let's suppose that user "database" needs to be able to open up to
10240 files at once.

In /etc/security/limits.conf, add the following line:

database hard nofile 10240

In /home/database/.bash_profile add the following line:

ulimit -n 10240

Now shutdown and reboot. Now, whenever "database" logs in, his
file limit will be 10240. This assumes that the login shell for
database is bash. Of course, if a daemon needs these
privileges, this won't work, since there is no interactive
login shell. You may need to modify the daemon's start-up script
in this case to add the ulimit command.

If you want the limit to apply to all users, edit /etc/profile
instead of ~/.bash_profile. And in /etc/security/limits.conf,
substitute an asterisk (*) for the userid "database". Again,
this assumes an interactive login shell of bash. Daemons, since they don't
have an interactive login shell, won't execute that ulimit
command. You'll have to find a place to put it. The startup
script in /etc/init.d might be a good place. But watch for
upgrades to the startup script which remove the modification.
If someone else has a better idea for how to implement this,
let me know.


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
From: Stephen Powell on
On 2010-01-26 at 16:44:33 -0500, Stephen Powell wrote:
> In /etc/security/limits.conf, add the following line:
>
> database hard nofile 10240
>
> In /home/database/.bash_profile add the following line:
>
> ulimit -n 10240

I just thought of another way, which I think is even better.
In /etc/security/limits.conf, add *two* lines, in this order:

database hard nofile 10240
database soft nofile 10240

That way, you don't have to mess with a bash profile. And it
should affect daemons too, without modifying their startup
scripts. If you want the change to affect all users, change
the word "database" to an asterisk (*). If you want it to
affect all members of a group, use an "at sign" (@) in front
of the group name, such as @sys.

----- Original Message -----
From: Stephen Powell <zlinuxman(a)wowway.com>
To: debian-user(a)lists.debian.org
Sent: Tue, 26 Jan 2010 16:44:33 -0500 (EST)
Subject: Re: how to set permanent ulimit

On 2010-01-26 at 15:53:37 -0500, Vadkan Jozsef wrote:
> so the question still is: how can I set ulimit to be permanent? e.g.:
> 10240 after reboot? :D
>
> there's no way for it?:O

I believe that Alex and I just told you, in effect.
But if you need detailed instructions, OK. :-(

First of all, it depends on whether you want this limit changed for
all users, all users of a group, or just one user, such as a database
server's userid. I'll give you an example for a single user.
I hope you can adapt these instructions if that's not the case.
Let's suppose that user "database" needs to be able to open up to
10240 files at once.

In /etc/security/limits.conf, add the following line:

database hard nofile 10240

In /home/database/.bash_profile add the following line:

ulimit -n 10240

Now shutdown and reboot. Now, whenever "database" logs in, his
file limit will be 10240. This assumes that the login shell for
database is bash. Of course, if a daemon needs these
privileges, this won't work, since there is no interactive
login shell. You may need to modify the daemon's start-up script
in this case to add the ulimit command.

If you want the limit to apply to all users, edit /etc/profile
instead of ~/.bash_profile. And in /etc/security/limits.conf,
substitute an asterisk (*) for the userid "database". Again,
this assumes an interactive login shell of bash. Daemons, since they don't
have an interactive login shell, won't execute that ulimit
command. You'll have to find a place to put it. The startup
script in /etc/init.d might be a good place. But watch for
upgrades to the startup script which remove the modification.
If someone else has a better idea for how to implement this,
let me know.


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org



--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
From: Vadkan Jozsef on
i wrote this two lines:


* hard nofile 10240
* soft nofile 10240

in /etc/security/limits.conf, reboot
but its now working.

On k, 2010-01-26 at 17:03 -0500, Stephen Powell wrote:
> On 2010-01-26 at 16:44:33 -0500, Stephen Powell wrote:
> > In /etc/security/limits.conf, add the following line:
> >
> > database hard nofile 10240
> >
> > In /home/database/.bash_profile add the following line:
> >
> > ulimit -n 10240
>
> I just thought of another way, which I think is even better.
> In /etc/security/limits.conf, add *two* lines, in this order:
>
> database hard nofile 10240
> database soft nofile 10240
>
> That way, you don't have to mess with a bash profile. And it
> should affect daemons too, without modifying their startup
> scripts. If you want the change to affect all users, change
> the word "database" to an asterisk (*). If you want it to
> affect all members of a group, use an "at sign" (@) in front
> of the group name, such as @sys.
>
> ----- Original Message -----
> From: Stephen Powell <zlinuxman(a)wowway.com>
> To: debian-user(a)lists.debian.org
> Sent: Tue, 26 Jan 2010 16:44:33 -0500 (EST)
> Subject: Re: how to set permanent ulimit
>
> On 2010-01-26 at 15:53:37 -0500, Vadkan Jozsef wrote:
> > so the question still is: how can I set ulimit to be permanent? e.g.:
> > 10240 after reboot? :D
> >
> > there's no way for it?:O
>
> I believe that Alex and I just told you, in effect.
> But if you need detailed instructions, OK. :-(
>
> First of all, it depends on whether you want this limit changed for
> all users, all users of a group, or just one user, such as a database
> server's userid. I'll give you an example for a single user.
> I hope you can adapt these instructions if that's not the case.
> Let's suppose that user "database" needs to be able to open up to
> 10240 files at once.
>
> In /etc/security/limits.conf, add the following line:
>
> database hard nofile 10240
>
> In /home/database/.bash_profile add the following line:
>
> ulimit -n 10240
>
> Now shutdown and reboot. Now, whenever "database" logs in, his
> file limit will be 10240. This assumes that the login shell for
> database is bash. Of course, if a daemon needs these
> privileges, this won't work, since there is no interactive
> login shell. You may need to modify the daemon's start-up script
> in this case to add the ulimit command.
>
> If you want the limit to apply to all users, edit /etc/profile
> instead of ~/.bash_profile. And in /etc/security/limits.conf,
> substitute an asterisk (*) for the userid "database". Again,
> this assumes an interactive login shell of bash. Daemons, since they don't
> have an interactive login shell, won't execute that ulimit
> command. You'll have to find a place to put it. The startup
> script in /etc/init.d might be a good place. But watch for
> upgrades to the startup script which remove the modification.
> If someone else has a better idea for how to implement this,
> let me know.
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
>
>
>



--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
From: Stephen Powell on
On 2010-01-01 at 19:04:22 -0500, Vadkan Jozsef wrote:
> i wrote this two lines:
>
> * hard nofile 10240
> * soft nofile 10240
>
> in /etc/security/limits.conf, reboot
> but its now working.

That does not make sense. Do you mean "and it's now working",
or do you mean "but it's not working"?

The asterisk does start in column 1 of the file, right?
And there's no pound sign (#) in front of it, right?
The lines which start with a pound sign are comments.
The default version of this file is either blank lines
or comments; there are no effective lines in it.


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org