{
    "mode": "man",
    "parameter": "CGRULES.CONF",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/CGRULES.CONF/5/json",
    "generated": "2026-10-21T15:18:16Z",
    "sections": {
        "NAME": {
            "content": "cgrules.conf - libcgroup configuration file\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "cgrules.conf  configuration  file  is  used by libcgroups to define control groups to which a\nprocess belongs.\n\n\nThe file contains a list of rules which assign to a defined group/user a control group  in  a\nsubsystem (or control groups in subsystems).\n\nRules have two formats:\n\n<user>                   <controllers>       <destination>\n<user>:<process name>    <controllers>       <destination>\n\nWhere:\n\nuser can be:\n- a user name\n- a group name with @group syntax\n- the wildcard '*', for any user or group\n- '%', which is equivalent to \"ditto\" (useful for\nmulti-line rules where different cgroups need to be\nspecified for various hierarchies for a single user)\n\nprocess name is optional and it can be:\n- a process name\n- a full command path of a process\n\ncontrollers can be:\n- comma separated controller names (no spaces) or\n- * (for all mounted controllers)\n\ndestination can be:\n- path relative to the controller hierarchy (ex. pgrp1/gid1/uid1)\n- following strings called \"templates\" and will get expanded\n\n%u     uid\n%U     username, uid if name resolving fails\n%g     gid\n%G     group name, gid if name resolving fails\n%p     pid\n%P     process name, pid if name not available\n\n'\\' can be used to escape '%'\nFirst rule which matches the criteria will be executed.\n\nAny text starting with '#' is considered as a start of comment line and is ignored.\n\nIf the destination contains template string, the control group can be created on-fly. In time\nwhen  some  process  wants  to use the template rule which leads to control group (see cgexec\n(1)) and the control group does not exist, the group is created. The template  control  group\nparameters can be specified in cgconfig.conf configuration file. See (cgconfig.conf (5)).  If\nthe template definition is not found there created group have default kernel setting.\n\nTo create a hierarchy of configuration files, use /etc/cgrules.d directory.\n\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "student         devices         /usergroup/students\nStudent's  processes  in  the 'devices' subsystem belong to the control group /usergroup/stu‐\ndents.\n\nstudent:cp       devices         /usergroup/students/cp\nWhen student executes 'cp' command, the processes in the 'devices' subsystem  belong  to  the\ncontrol group /usergroup/students/cp.\n\n@admin           *              admingroup/\nProcesses  started by anybody from admin group no matter in what subsystem belong to the con‐\ntrol group admingroup/.\n\npeter           cpu             test1/\n%               memory          test2/\nThe first line says Peter's task for cpu controller belongs to test1 control group. The  sec‐\nond one says Peter's tasks for memory controller belong to test2/ control group.\n\n*               *               default/\nAll  processes  in  any  subsystem  belong  to the control group default/. Since the earliest\nmatched rule is applied, it makes sense to have this line at the end of the list. It will put\na task which was not mentioned in the previous rules to default/ control group.\n\n@students cpu,cpuacct    students/%u\nProcesses in cpu and cpuacct subsystems started by anybody  from  students  group  belong  to\ngroup students/name. Where \"name\" is user name of owner of the process.\n\n\n\n",
            "subsections": []
        },
        "FILES": {
            "content": "",
            "subsections": [
                {
                    "name": "/etc/cgrules.conf",
                    "content": "default libcgroup configuration file"
                },
                {
                    "name": "/etc/cgrules.d",
                    "content": "default libcgroup configuration files directory\n\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "cgconfig.conf (5), cgclassify (1), cgred.conf (5), cgrules.d (5)\n\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Linux                                        2009-03-10                              CGRULES.CONF(5)",
            "subsections": []
        }
    },
    "summary": "cgrules.conf - libcgroup configuration file",
    "flags": [],
    "examples": [
        "student         devices         /usergroup/students",
        "Student's  processes  in  the 'devices' subsystem belong to the control group /usergroup/stu‐",
        "dents.",
        "student:cp       devices         /usergroup/students/cp",
        "When student executes 'cp' command, the processes in the 'devices' subsystem  belong  to  the",
        "control group /usergroup/students/cp.",
        "@admin           *              admingroup/",
        "Processes  started by anybody from admin group no matter in what subsystem belong to the con‐",
        "trol group admingroup/.",
        "peter           cpu             test1/",
        "%               memory          test2/",
        "The first line says Peter's task for cpu controller belongs to test1 control group. The  sec‐",
        "ond one says Peter's tasks for memory controller belong to test2/ control group.",
        "*               *               default/",
        "All  processes  in  any  subsystem  belong  to the control group default/. Since the earliest",
        "matched rule is applied, it makes sense to have this line at the end of the list. It will put",
        "a task which was not mentioned in the previous rules to default/ control group.",
        "@students cpu,cpuacct    students/%u",
        "Processes in cpu and cpuacct subsystems started by anybody  from  students  group  belong  to",
        "group students/name. Where \"name\" is user name of owner of the process."
    ],
    "see_also": []
}