Welcome to the Linux Foundation Forum!

Lab 3.1

This is the lab:

1. Start a new shell by typing bash (or opening a new terminal) so that your changes are only effective in the new shell. View the current limit on the number of open files and explicitly view the hard and soft limits.

2. Set the limit to the hard limit value and verify if it worked.

3. Set the hard limit to 2048 and verify it worked.

4. Try to set the limit back to the previous value. Did it work?

 

This is my question:

In the solution of this lab I can read: "Note that if we had chosen a different limit, such as stack size (-s) we could raise back up again as the hard limit is unlimited." Really? It seems that this is not the case. (Operation not permitted).


$ ulimit -s

8192

$ ulimit -Ss

8192

$ ulimit -Hs

unlimited

$ ulimit -s hard

$ ulimit -Ss

unlimited

$ ulimit -Hs

unlimited

$ ulimit -s 2048

$ ulimit -s

2048

$ ulimit -Ss

2048

$ ulimit -Hs

2048 (uhmmm...)

$ ulimit -s 3000

bash: ulimit: stack size: cannot modify limit: Operation not permitted

So...what am I doing wrong?

Comments

  • i think what it just meant is that you could have increased back to original value or any value any limit set to unlimited as long as it remains unlimited. My understanding is just you can decrease as much as you want but you can't increase higher of the hard limit, unless specified otherwise in /etc/security/limits.conf or by superuser.

  • ulimit set both soft and hard limits by default. Also prints soft or current limit by defalut.

    So...

    $ ulimit -s hard (set both soft and hard to unlimited)

    $ ulimit -s (prints new soft limit)

    unlimited

    $ ulimit -Ss 2048 (set soft limit to 2048 and hard remains unlimited)

    $ ulimit -s

    2048

    $ ulimit -Hs

    unlimited

    $ ulimit -Ss 4096 (raise soft limit to 4096)

    $ ulimit -s

    4096

    $ ulimit -Hs

    unlimited

    Sorry.

Categories

Upcoming Training