0

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.
 

1 answers, 0 votes, 330 views
Visitor's picture
asked by Visitor
6 weeks 4 days ago



1 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 4 weeks 3 days ago
  • Answer
    0

    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
    6 weeks 2 days ago

    Asked by

    Visitor's picture
    Visitor

    View in your own language!