Limit Maximum File Size
We can limit the file size of the file by using the fsize item. This limit can be useful to restrict temp or similar usage type files. So to limit gfg having a single file size of 4 GB we can use the following limit:
@gfg - fsize 4000000
The file size is presented in the KB. Use the different domains and items to apply different limits on the user, system, and groups.
Now to know the limits on the process we can use the cat command with process PID to know process PID use ps command.
cat /proc/PID/limits
Here is example
The output is the same as the limits.conf file fields. To know more about the limits.conf file setting use man command
man limits.conf
limits.conf File To Limit Users, Process In Linux With Examples
Linux gives full control over the system. In this article, we are going to learn about the file limits.conf. limits.conf is a configuration that is used to limit the resources to the user, groups. Now let’s understand the file structure of limits.conf and how can we use the limits.conf to limit resources to the user. Before moving further, note that to edit this file, you must have root permission.
The complete path of the limits.config is :
/etc/security/limits.conf
pam_module is a module that uses ulimit command to apply limits from limits.conf file.
The basic syntax of the limits.conf file is :
<domain><type><item><value>
Now let’s understand each field one by one