https://serverfault.com/questions/836929/can-not-login-after-change-limits-conf
ssh user@server 'echo "fs.file-max = 10000000" > /etc/sysctl.conf; echo "fs.nr_open = 10000000" >> /etc/sysctl.conf'
Posted on April 12, 2014 by Ben · 3 Comments
A quick thing I ran into today using ulimit. Quick, helpful, short. So short maybe it didn’t necessitate such a long blog title.
Helpful commands you are likely looking for
Sponsored Links
ulimit provides control over resources available to each user via a shell. You can type “ulimit -a” to get a list of all current settings. In parentheses you will see one or two items: the units in measurements (e.g. kbytes, blocks, seconds) as well as a letter option (e.g. -s, -t, -u). The letter option will let you view/edit one particular setting at a time.
Using “ulimit -a” you can see all the values you can set. Using the man page you can get more details about what these are.
See below:
You can also look in the man page, though I prefer viewing the /etc/security/limits.conf file for more info. Easier to read. See excerpt below:
Yes, they can do so by putting a “ulimit” command in their shell startup file (typically .bashrc, .bash_profile, .cshrc, .profile, etc.)
e.g. if user wants to change soft limit for stack size to 8192, they put this in their login start up file:
ulimit -S -s 8192
If it is a script they are running (e.g. out of cron), they can also put this statement at the start of their shell script.
Superuser a.k.a. root can edit the /etc/security/limits.conf file for that user
With all the above bullet points made, here is an example /etc/security/limits.conf file for you to see. Mostly self explanatory on all the options, and you’ll see I changed the default “soft” and “hard” stack for a specific user “byau”
I opted for a screenshot instead of copy/paste because the copy/paste did not properly format (*sigh*). Making the screenshot much easier to read:
http://geekswing.com/geek/quickie-tutorial-ulimit-soft-limits-hard-limits-soft-stack-hard-stack/