I ran ulimit -n and it is current showing as 1024. I want to increase my file limit from 1024 to 4084. So, i tried running the following command
 
sudo ulimit -n 2048
 
but i get the following error
 
sudo: ulimit: command not found
 
How to increase the file limit from 1024 to 4084. Any help will be appreciated.
 

2 answers, votes, 18392 views
Visitor's picture
asked by Visitor
2 years 1 week ago



2 Answers

  • If you are root, execute the command below
    ulimit -SHn 65535
    If you want to set it permanently, especially for a particular user, change the file /etc/security/limits.conf to have the following lines (assume user = www-data)
    E.g.
    www-data hard nofile 65535
    www-data soft nofile 65535

    And make sure uncomment pam_limits.so from the different files under /etc/pam.d, e.g. sudologinsshd, ...
    Finally restart your system
    Source:

    http://www.linuxask.com/questions/increase-the-maximum-number-of-open-files-file-descriptors
     

    - Visitor 1 year 51 weeks ago
  • Answer

    pam limits by default is not loaded in ubuntu. So run the following command in a terminal
     
    sudo gedit /etc/pam.d/su
     
    uncomment the following line
     
    #session    required   pam_limits.so
    to
    session    required   pam_limits.so
     
    save and close the editor.
     
    Now run the following command in terminal
     
    sudo gedit /etc/security/limits.conf
     
    and add the following lines to the end of the file (before the line # End of file)
    *       soft  nofile   4084                                                     
    *       hard  nofile   4084
     
    Now reboot the machine and run ulimit -a and see the open files limits are now updated. enjoy!!

    Visitor's picture
    answer by Visitor
    2 years 1 week ago
  • Ubuntu Linux 8.04.3 - following these instructions accomplishes nothing

    - Visitor 22 weeks 6 days ago
  • I can confirm that reboot is not required - just a logout/login.

    - Visitor 49 weeks 4 days ago
  • I can confirm that reboot is not required - just a logout/login.

    - Visitor 49 weeks 4 days ago
  • Still not working for me..... :(
    I have followed complete instructions as you detailed but not working.

    - Visitor 50 weeks 12 hours ago
  • reboot may not be required, just logout and login.

    - Visitor 1 year 26 weeks ago
  • Answer

    sudo -i <enter>

    Then you will be able to use ulimit as root.

    Visitor's picture
    answer by Visitor
    15 min 48 sec ago

    Ubuntu 11.04 released!

    Ubuntu 11.04 code named natty narwhal is released download ubuntu 11.04

    Read ubuntu 11.10 reviews and share yours now!!

    View in your own language!

    Stay Connected

    Ubun2.com on Facebook Ubun2.com on Twitter RSS Feeds

    Poll

    Favorite desktop environment?: