{
    "mode": "man",
    "parameter": "APPARMOR",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/APPARMOR/7/json",
    "generated": "2026-05-30T06:05:16Z",
    "sections": {
        "NAME": {
            "content": "AppArmor - kernel enhancement to confine programs to a limited set of resources.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "AppArmor is a kernel enhancement to confine programs to a limited set of resources.\nAppArmor's unique security model is to bind access control attributes to programs rather than\nto users.\n\nAppArmor confinement is provided via profiles loaded into the kernel via apparmorparser(8),\ntypically through the /etc/init.d/apparmor SysV initscript, which is used like this:\n\n# /etc/init.d/apparmor start\n# /etc/init.d/apparmor stop\n# /etc/init.d/apparmor restart\n\nAppArmor can operate in two modes: enforcement, and complain or learning:\n\n•   enforcement -  Profiles loaded in enforcement mode will result in enforcement of the\npolicy defined in the profile as well as reporting policy violation attempts to syslogd.\n\n•   complain - Profiles loaded in  \"complain\" mode will not enforce policy.  Instead, it will\nreport policy violation attempts. This mode is convenient for developing profiles. To\nmanage complain mode for individual profiles the utilities aa-complain(8) and\naa-enforce(8) can be used.  These utilities take a program name as an argument.\n\nProfiles are traditionally stored in files in /etc/apparmor.d/ under filenames with the\nconvention of replacing the / in pathnames with . (except for the root /) so profiles are\neasier to manage (e.g. the /usr/sbin/nscd profile would be named usr.sbin.nscd).\n\nProfiles are applied to a process at exec(3) time (as seen through the execve(2) system\ncall): once a profile is loaded for a program, that program will be confined on the next\nexec(3). If a process is already running under a profile, when one replaces that profile in\nthe kernel, the updated profile is applied immediately to that process.  On the other hand, a\nprocess that is already running unconfined cannot be confined.\n\nAppArmor supports the Linux kernel's securityfs filesystem, and makes available the list of\nthe profiles currently loaded; to mount the filesystem:\n\n# mount -tsecurityfs securityfs /sys/kernel/security\n$ cat /sys/kernel/security/apparmor/profiles\n/usr/bin/mutt\n/usr/bin/gpg\n...\n\nNormally, the initscript will mount securityfs if it has not already been done.\n\nAppArmor also restricts what privileged operations a confined process may execute, even if\nthe process is running as root. A confined process cannot call the following system calls:\n\ncreatemodule(2) deletemodule(2) initmodule(2) ioperm(2)\niopl(2) ptrace(2) reboot(2) setdomainname(2)\nsethostname(2) swapoff(2) swapon(2) sysctl(2)\n",
            "subsections": []
        },
        "ERRORS": {
            "content": "When a confined process tries to access a file it does not have permission to access, the\nkernel will report a message through audit, similar to:\n\naudit(1386511672.612:238): apparmor=\"DENIED\" operation=\"exec\"\nparent=7589 profile=\"/tmp/sh\" name=\"/bin/uname\" pid=7605\ncomm=\"sh\" requestedmask=\"x\" deniedmask=\"x\" fsuid=0 ouid=0\n\naudit(1386511672.613:239): apparmor=\"DENIED\" operation=\"open\"\nparent=7589 profile=\"/tmp/sh\" name=\"/bin/uname\" pid=7605\ncomm=\"sh\" requestedmask=\"r\" deniedmask=\"r\" fsuid=0 ouid=0\n\naudit(1386511772.804:246): apparmor=\"DENIED\" operation=\"capable\"\nparent=7246 profile=\"/tmp/sh\" pid=7589 comm=\"sh\" pid=7589\ncomm=\"sh\" capability=2  capname=\"dacoverride\"\n\nThe permissions requested by the process are described in the operation= and deniedmask=\n(for files - capabilities etc. use a slightly different log format).  The \"name\" and process\nid of the running program are reported, as well as the profile name including any \"hat\" that\nmay be active, separated by \"//\". (\"Name\" is in quotes, because the process name is limited\nto 15 bytes; it is the same as reported through the Berkeley process accounting.)\n\nFor confined processes running under a profile that has been loaded in complain mode,\nenforcement will not take place and the log messages reported to audit will be of the form:\n\naudit(1386512577.017:275): apparmor=\"ALLOWED\" operation=\"open\"\nparent=8012 profile=\"/usr/bin/du\" name=\"/etc/apparmor.d/tunables/\"\npid=8049 comm=\"du\" requestedmask=\"r\" deniedmask=\"r\" fsuid=1000 ouid=0\n\naudit(1386512577.017:276): apparmor=\"ALLOWED\" operation=\"open\"\nparent=8012 profile=\"/usr/bin/du\" name=\"/etc/apparmor.d/tunables/\"\npid=8049 comm=\"du\" requestedmask=\"r\" deniedmask=\"r\" fsuid=1000 ouid=0\n\nIf the userland auditd is not running, the kernel will send audit events to klogd; klogd will\nsend the messages to syslog, which will log the messages with the KERN facility. Thus,\nREJECTING and PERMITTING messages may go to either /var/log/audit/audit.log or\n/var/log/messages, depending upon local configuration.\n",
            "subsections": []
        },
        "DEBUGGING": {
            "content": "AppArmor provides a few facilities to log more information, which can help debugging\nprofiles.\n",
            "subsections": [
                {
                    "name": "Enable debug mode",
                    "content": "When debug mode is enabled, AppArmor will log a few extra messages to dmesg (not via the\naudit subsystem). For example, the logs will tell whether environment scrubbing has been\napplied.\n\nTo enable debug mode, run:\n\necho 1 > /sys/module/apparmor/parameters/debug\n"
                },
                {
                    "name": "Turn off deny audit quieting",
                    "content": "By default, operations that trigger \"deny\" rules are not logged.  This is called deny audit\nquieting.\n\nTo turn off deny audit quieting, run:\n\necho -n noquiet >/sys/module/apparmor/parameters/audit\n"
                },
                {
                    "name": "Force audit mode",
                    "content": "AppArmor can log a message for every operation that triggers a rule configured in the policy.\nThis is called force audit mode.\n\nWarning! Force audit mode can be extremely noisy even for a single profile, let alone when\nenabled globally.\n\nTo set a specific profile in force audit mode, add the \"audit\" flag:\n\nprofile foo flags=(audit) { ... }\n\nTo enable force audit mode globally, run:\n\necho -n all > /sys/module/apparmor/parameters/audit\n\nIf auditd is not running, to avoid losing too many of the extra log messages, you will likely\nhave to turn off rate limiting by doing:\n\necho 0 > /proc/sys/kernel/printkratelimit\n\nBut even then the kernel ring buffer may overflow and you might lose messages.\n\nElse, if auditd is running, see auditd(8) and auditd.conf(5).\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/init.d/apparmor\n/etc/apparmor.d/\n/var/lib/apparmor/\n/var/log/audit/audit.log\n/var/log/messages\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "apparmorparser(8), aachangehat(2), apparmor.d(5), aa-autodep(1), clean(1), auditd(8),\naa-unconfined(8), aa-enforce(1), aa-complain(1), and <https://wiki.apparmor.net>.\n\n\n\nAppArmor 3.0.4                               2025-08-15                                  APPARMOR(7)",
            "subsections": []
        }
    },
    "summary": "AppArmor - kernel enhancement to confine programs to a limited set of resources.",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "apparmorparser",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/apparmorparser/8/json"
        },
        {
            "name": "aachangehat",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/aachangehat/2/json"
        },
        {
            "name": "apparmor.d",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/apparmor.d/5/json"
        },
        {
            "name": "aa-autodep",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/aa-autodep/1/json"
        },
        {
            "name": "clean",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/clean/1/json"
        },
        {
            "name": "auditd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/auditd/8/json"
        },
        {
            "name": "aa-unconfined",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/aa-unconfined/8/json"
        },
        {
            "name": "aa-enforce",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/aa-enforce/1/json"
        },
        {
            "name": "aa-complain",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/aa-complain/1/json"
        }
    ]
}