LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-13-2009, 03:35 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
How can I change the limit of 'Open Files' in ulimit?


I can use the ulimit -a to list the open file. The 'Open Files' is 1024.


Code:
-bash-2.05b$ ulimit -a
core file size        (blocks, -c) 0
data seg size         (kbytes, -d) unlimited
file size             (blocks, -f) unlimited
max locked memory     (kbytes, -l) 4
max memory size       (kbytes, -m) unlimited
open files                    (-n) 1024
pipe size          (512 bytes, -p) 8
stack size            (kbytes, -s) 10240
cpu time             (seconds, -t) unlimited
max user processes            (-u) 7168
virtual memory        (kbytes, -v) unlimited

Now I want to to increase the number. How can I do that?

Besides, I will change this 'Open Files' not for /root but for a sub-user.

Last edited by thomas2004ch; 11-13-2009 at 03:43 AM.
 
Old 11-13-2009, 03:45 AM   #2
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
I tried as follow but failed:
Code:
ulimit -n 5000
I got error:
Code:
ulimit: open files: cannot modify limit: Operation not permitted
 
Old 11-13-2009, 06:16 AM   #3
maniannam
Member
 
Registered: Dec 2007
Location: India
Distribution: fedora 11
Posts: 64

Rep: Reputation: 16
Quote:
Originally Posted by thomas2004ch View Post
I tried as follow but failed:
Code:
ulimit -n 5000
I got error:
Code:
ulimit: open files: cannot modify limit: Operation not permitted
-n option is correct, but you have root access.


- maniannam
 
Old 11-17-2009, 03:37 AM   #4
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by maniannam View Post
-n option is correct, but you have root access.

I don't understand what you mean "you have root access" here. Do you mean I have to login as root? I can do this when I login as root. But this will change all the 'open files' to all users. This is what I don't want. I just want to change one of the user's 'open files'.
 
Old 11-17-2009, 03:53 AM   #5
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
I think , you must see
/etc/security/limits.conf

thanks
 
Old 11-17-2009, 04:10 AM   #6
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by vishesh View Post
I think , you must see
/etc/security/limits.conf

thanks

Here is my 'limits.conf'. How can I change?


Code:
[root@s003ap05-test ~]# cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - an user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4
apache           -       nofile         5000
# End of file
[root@s003ap05-test ~]#
 
Old 11-17-2009, 04:20 AM   #7
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
root# vi /etc/security/limits.conf
(Enter following two lines at end of file by replaceing username )
<username> soft nofile 25
<username> hard nofile 30

--
here 25 and 30 are soft and hard limit corresponding.

Thanks

Last edited by vishesh; 11-17-2009 at 04:31 AM.
 
Old 11-17-2009, 05:09 AM   #8
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by vishesh View Post
root# vi /etc/security/limits.conf
(Enter following two lines at end of file by replaceing username )
<username> soft nofile 25
<username> hard nofile 30

--
here 25 and 30 are soft and hard limit corresponding.

Thanks
Thanks.

But if I do as follow:
Code:
 <username> - nofile 25
What is the difference?
 
Old 11-17-2009, 05:12 AM   #9
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
I think 25 will be your limit of open files.

Thanks
 
Old 11-17-2009, 05:16 AM   #10
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by vishesh View Post
I think 25 will be your limit of open files.

Thanks
Does this mean in my case both hard and soft has limit of 25?
 
Old 11-17-2009, 05:21 AM   #11
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Yes, i am not 100% sure but i think both hard and soft will limit of 25.

Thanks

Last edited by vishesh; 11-17-2009 at 05:24 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
-bash: ulimit: open files: cannot modify limit: Operation not permitted pjglinuxq Linux - Server 3 06-11-2010 06:19 AM
-bash: ulimit: open files: cannot modify limit: Operation not permitted investmentbnker75 Linux - Newbie 12 10-09-2009 06:52 AM
Open Files (ulimit -n) questions megablue Linux - General 1 07-31-2006 12:35 AM
Setting ulimit to increase # of open files dieyouspammer Slackware 6 02-01-2006 02:42 AM
change user's ulimit (open files) mpregent Linux - Newbie 1 07-07-2004 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration