Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)

After SSH'ing into an EC2 instance running the Amazon Linux AMI, I tried:

ulimit -n 20000

...and got the following error:

-bash: ulimit: open files: cannot modify limit: Operation not permitted

However, the shell allows me to decrease this number, for the current session only.

Is there anyway to increase the ulimit on an EC2 instance (permanently)?

closed

1 Answer

+2 votes
by (18.2k points)
selected by
 
Best answer

If you change the values through ulimit command, it will only apply the changes to the current shell session. For permanent changes, you will have to edit limits.conf file and set your hard and soft limits. You can find your limits.conf file in /etc/security/limits.conf

here's how you can do it:

# <domain> <type> <item>  <value>

    *       soft  nofile  20000

    *       hard  nofile  20000

Save this file.

Logout and login again, run the ulimit -n command to test the configuration.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

Browse Categories

...