Microsoft Defender for Endpoint
Endpoint protection

Configure and validate exclusions for Microsoft Defender for Endpoint on Linux

In brief

The article now includes an mdatp_managed.json example and expanded CLI examples for adding and removing extension, file, folder, and process exclusions. It also clarifies the difference between antivirus (epp) and global exclusions, including their EDR impact.

What Defender admins need to know

Administrators can more easily configure, verify, and remove Linux exclusions while understanding that global exclusions also affect EDR processing.

Summaries are generated from the documentation change itself.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

Configure and validate exclusions for Microsoft Defender for Endpoint on Linux

This article provides information on how to define antivirus and global exclusions for Microsoft Defender for Endpoint. Antivirus exclusions apply to on-demand scans, real-time protection (RTP), and behavior monitoring (BM). Global exclusions apply to real-time protection (RTP), behavior monitoring (BM), and endpoint detection and response (EDR), thus stopping all the associated antivirus detections, EDR alerts, and visibility for the excluded item.

You can exclude certain files, folders, processes, and process-opened files from Defender for Endpoint on Linux.

Configure exclusions using a management console

In enterprise environments, exclusions can also be managed through a configuration profile. Typically, you would use a configuration management tool like Puppet, Ansible, or another management console to push a file with the name mdatp_managed.json at the location /etc/opt/microsoft/mdatp/managed/. For more information, see Set preferences for Defender for Endpoint on Linux.

The following mdatp_managed.json example shows how to configure antivirus and global exclusions for files, folders, extensions, and processes:

{

#### 2. Create a Microsoft Entra group

Create a dynamic Microsoft Entra group based on the operating system type to ensure that all devices onboarded to Defender for Endpoint receive the appropriate policies. This dynamic group automatically includes devices managed by Defender for Endpoint, eliminating the need for admins to manually create new policies. For more information, see the following article: [Create Microsoft Entra Groups](/intune/intune-service/protect/mde-security-integration#create-microsoft-entra-groups).

#### 3. Create an endpoint security policy

<a name="using-the-command-line"></a>
### Configure exclusions using the command line

RunTo view the following command to see the available subcommands and switches for managing exclusions:exclusions, run the `mdatp exclusion` command:

```bash
mdatp exclusion

The following examples show how to configure exclusions by using the command line.

Example 1: Add an exclusion for a file extension

You can add an exclusion for a file extension. Keep in mind that extension exclusions aren't supported for the global exclusion scope.

To add an antivirus exclusion for the .txt file extension, run the following command:

mdatp exclusion extension add --name .txt

If the command succeeds, the output confirms the exclusion was added:

Extension exclusion configured successfully

To remove the .txt extension exclusion, run the following command:

mdatp exclusion extension remove --name .txt

If the exclusion is removed successfully, you see the following output:

Extension exclusion removed successfully

Example 2: Add or remove a file exclusion

You can add or remove an exclusion for a file. The file path should already be present if you're adding or removing an exclusion with the global scope.

To add a file exclusion with the antivirus (epp) scope, which excludes the file from on-demand scans, real-time protection, and behavior monitoring, run the following command:

mdatp exclusion file add --path /var/log/dummy.log --scope epp

If the command succeeds, you see the following output:

File exclusion configured successfully

To remove the antivirus file exclusion, run the following command:

mdatp exclusion file remove --path /var/log/dummy.log --scope epp

On success, the CLI returns output similar to the following:

File exclusion removed successfully"

To add the same file exclusion with the global scope, which excludes the file from both antivirus and EDR processing, run the following command:

mdatp exclusion file add --path /var/log/dummy.log --scope global

On success, the CLI returns output similar to the following:

File exclusion configured successfully

To remove the global file exclusion, run the following command:

mdatp exclusion file remove --path /var/log/dummy.log --scope global

If the exclusion is removed successfully, you see the following output:

File exclusion removed successfully"

Example 3: Add or remove a folder exclusion

You can add or remove an exclusion for a folder. The following command adds a folder exclusion with the antivirus (epp) scope:

mdatp exclusion folder add --path /var/log/ --scope epp

If the command succeeds, you see the following output:

Folder exclusion configured successfully

To remove the antivirus folder exclusion, run the following command:

mdatp exclusion folder remove --path /var/log/ --scope epp

If the exclusion is removed successfully, you see the following output:

Folder exclusion removed successfully

To add the same folder exclusion with the global scope, run the following command:

mdatp exclusion folder add --path /var/log/ --scope global

On success, the CLI returns output similar to the following:

Folder exclusion configured successfully

To remove the global folder exclusion, run the following command:

mdatp exclusion folder remove --path /var/log/ --scope global

If the exclusion is removed successfully, you see the following output:

Folder exclusion removed successfully

mdatp exclusion folder add --path "/var/*/tmp"


Using the path `"/var/*/tmp"` excludes paths under `*/var/*/tmp/*`, but not folders that are siblings of `*tmp*`. For example, `*/var/this-subfolder/tmp*` is excluded, but `*/var/this-subfolder/log*` isn't excluded.

```bash
mdatp exclusion folder add --path "/var/" --scope epp
mdatp exclusion folder add --path "/var/*/" --scope epp

Either of these commands excludes all paths whose parent is */var/*, such as */var/this-subfolder/and-this-subfolder-as-well*.

Folder exclusion configured successfully
Process exclusion removed successfully

For antivirus exclusions, you can also use just the process name instead of the full path with the --name flag. The following command adds an antivirus process exclusion by name:

mdatp exclusion process add --name cat --scope epp

If the command succeeds, you see the following output:

Process exclusion configured successfully

To remove the antivirus process exclusion by name, run the following command:

mdatp exclusion process remove --name cat --scope epp

If the exclusion is removed successfully, you see the following output:

Process exclusion removed successfully

Example 7: Add an exclusion for a second process

You can add exclusions for multiple processes with different scopes. The following commands add an antivirus (epp) exclusion by process name and a global exclusion by full path:

mdatp exclusion process add --name cat --scope epp
mdatp exclusion process add --path /usr/bin/dog --scope global

If the commands succeed, you see the following output:

Process exclusion configured successfully

mdatp threat allowed add --name "EICAR-Test-File (not a virus)"


<a name="see-also"></a>
## Related content

The following articles provide more information about configuring and managing Defender for Endpoint on Linux:

- [Microsoft Defender for Endpoint on Linux](microsoft-defender-endpoint-linux.md)
- [Set preferences for Microsoft Defender for Endpoint on Linux](linux-preferences.md)