To set up user limits, we will need to edit the following file:
/etc/security/limits.conf
This file is used to apply ulimit created by the pam_module.
The file has the following syntax:
<domain> <type> <item> <value>
Each of the options is:
Domain – this includes usernames, groups, guid ranges etc
Type – soft and hard limits
Item – the item that will be limited – core size, file size, nproc etc
Value – this is the value for the given limit
A good sample for a limit is:
@student hard nproc 20
The above line sets a hard limit of maximum 20 processes on the "student" group.
If you want to see the limits of a certain process has you can simply “cat” the limits file like this:
# cat /proc/PID/limits
Where PID is the actual process ID, you can find out process id by using ps command.