Linux Commands - Resolve "ulimit: open files: cannot modify limit: Operation not permitted"

by
Jeremy Canfield |
Updated: September 27 2022
| Linux Commands articles
Let's say the following is being returned when attempting to do something on a Linux system.
ulimit: open files: cannot modify limit: Operation not permitted
This can occur when attempting to set a ulimit that exceeds the hard ulimit set in one of these files:
- /etc/security/limits.d/90-nproc.conf
- /etc/security/limits.conf
For example, let's say john.doe hard ulimit for nofile (open files) is 2048.
john.doe hard nofile 2048
If john.doe attempts to use the ulimit -n command with a value that exceeds 2048, this can cause "-bash: ulimit: open files: cannot modify limit: Operation not permitted". Typically, root or sudo is needed to make this change.
~]# ulimit -n 4096
Or, if the ulimit is set in /home/john.doe/.bash_profile, "-bash: ulimit: open files: cannot modify limit: Operation not permitted" may be displayed when john.doe makes an SSH connection.
Did you find this article helpful?
If so, consider buying me a coffee over at