User limits on Linux

Published: Monday, 1 September 2014

Each user’s processes can be resource restricted. This helps prevent malicious users from consuming excessive resources of a system. Resources items include the number of open files and memory.

Changing Limits

As root, edit /etc/security/limits.conf. You can add a record that will change limit based on user or group, resource item, and limit type (soft vs hard).

As the user, you can change your own limits using the ulimit command.

Current Limits

As the user, run ulimit -a to see your current limits.

Open Files

If you see the error Too many open files then the process has reached the system limit of number of open files.

To see which files are open run lsof which lists open files.

An alternative is to run ls -l /proc/PID/fd/, where PID is the process ID.