From: Vadkan Jozsef on 26 Jan 2010 13:00 How can I set ulimit? when I give: ulimit -n 10240 ok, ulimit -n gives 10240. But. after a few minutes, it 1024 again! How can I set the ulimit to be permanently 10240? It would be important! :S Thank you :\ -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
From: Boyd Stephen Smith Jr. on 26 Jan 2010 13:20 On Tuesday 26 January 2010 11:54:49 Vadkan Jozsef wrote: > How can I set ulimit? > > when I give: > > ulimit -n 10240 ulimits is an inheritable aspect of processes, like an environment variable. The ulimit "command" is actually a shell built-in that tell the shell process to increase its limit. > ok, > > ulimit -n > > gives 10240. But. after a few minutes, it 1024 again! The change will be inherited by all sub-processes (anything that was fork()ed or clone()d), but it won't change in any other process. I think you might be closing your terminal (which normally ends your shell process), then starting a new one (which starts a different shell process that isn't a sub-process of the original). > How can I set the ulimit to be permanently 10240? Most shells and Xsessions have some file or directory where select user commands can be placed to execute in the current process (e.g. via the "." (dot) a.k.a. "source" command in a shell). .kde/env -- for KDE sessions .zshrc -- (among others) for zsh sessions Consult your shell and/or DE documentation for details. -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss(a)iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/
From: Stephen Powell on 26 Jan 2010 13:50 On 2010-01-26 at 12:54:49 -0500, Vadkan Jozsef wrote: > How can I set ulimit? > when I give: > > ulimit -n 10240 > > ok, > > ulimit -n > > gives 10240. But. after a few minutes, it 1024 again! > How can I set the ulimit to be permanently 10240? > It would be important! :S > Thank you :\ man bash /ulimit Description for the -n option says The maximum number of open file descriptors (most systems do not allow this value to be set) Apparently, one must be root to set ulimit. I tried it as a non-root user and got -bash: ulimit: open files: cannot modify limit: Operation not permitted But as the root user it works. I don't know how long you waited, but so far, my changes are holding. I'm running bash version 3.2-4 under Lenny. However, the change holds only for the current shell session and shell sessions descended from it. Other shell sessions are not affected. The following will not work: $ su Password: [enter password for root] # ulimit -n 10240 # ulimit -n 10240 # exit $ ulimit -n 1024 The su command invokes a new shell. You change the limit in the new shell. The exit command takes you back to the previous shell. The limit in that shell is unchanged. If you did something like this: [login as fred] $ su Password: [enter password for root] # ulimit -n 10240 # su fred $ ulimit -n 10240 Then a non-root user (fred) gets the new value for ulimit. The first shell is the login shell. It's limit is still 1024. The second (nested) shell is the root shell entered by "su" with no arguments. It's limit starts as 1024 but is dynamically changed to 10240. The "su fred" command invokes a third nested shell, which inherits its ulimit value from the second nested shell. It's limit is 10240. But this requires a couple of nested shells, the second of which is still running as root, which is a security exposure. All the user has to do is type "exit" and he is now root! Maybe someone else knows a better way. -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
From: Alex Samad on 26 Jan 2010 14:50 On Tue, Jan 26, 2010 at 01:47:31PM -0500, Stephen Powell wrote: > On 2010-01-26 at 12:54:49 -0500, Vadkan Jozsef wrote: > > How can I set ulimit? > > when I give: > > > > ulimit -n 10240 > > > > ok, > > > > ulimit -n > > > > gives 10240. But. after a few minutes, it 1024 again! > > How can I set the ulimit to be permanently 10240? > > It would be important! :S > > Thank you :\ 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 > > man bash > /ulimit > > Description for the -n option says > > The maximum number of open file descriptors (most systems do not allow this value to be set) > > Apparently, one must be root to set ulimit. I tried it as a non-root user and got > > -bash: ulimit: open files: cannot modify limit: Operation not permitted > > But as the root user it works. I don't know how long you waited, but so far, my changes > are holding. I'm running bash version 3.2-4 under Lenny. However, the change holds only > for the current shell session and shell sessions descended from it. Other shell sessions > are not affected. The following will not work: > > $ su > Password: [enter password for root] > # ulimit -n 10240 > # ulimit -n > 10240 > # exit > $ ulimit -n > 1024 > > The su command invokes a new shell. You change the limit in the new shell. > The exit command takes you back to the previous shell. The limit in that > shell is unchanged. If you did something like this: > > [login as fred] > $ su > Password: [enter password for root] > # ulimit -n 10240 > # su fred > $ ulimit -n > 10240 > > Then a non-root user (fred) gets the new value for ulimit. > The first shell is the login shell. It's limit is still 1024. > The second (nested) shell is the root shell entered by "su" with no > arguments. It's limit starts as 1024 but is dynamically changed to 10240. > The "su fred" command invokes a third nested shell, which > inherits its ulimit value from the second nested shell. > It's limit is 10240. But this requires a couple of nested > shells, the second of which is still running as root, which > is a security exposure. All the user has to do is type "exit" > and he is now root! Maybe someone else knows a better way. > > -- At many levels, Perl is a "diagonal" language. -- Larry Wall in <199709021854.LAA12794(a)wall.org>
From: Stephen Powell on 26 Jan 2010 15:50 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
|
Next
|
Last
Pages: 1 2 3 Prev: Wireless Mouse vs. Cell Phone ?? (Found source?) Next: hangs with 2.6.32 on debian squeeze? |