---
title: Verify Permissions on Files in /etc/apt/auth.conf.d
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > Verify Permissions on Files in
  /etc/apt/auth.conf.d
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Verify Permissions on Files in /etc/apt/auth.conf.d
 
## Description{% #description %}

To properly set the permissions of `/etc/apt/auth.conf.d/*.conf`, run the command:

```
$ sudo chmod 0640 /etc/apt/auth.conf.d/*.conf
```

## Rationale{% #rationale %}

Files in /etc/apt/auth.conf.d may contain credentials for private repositories or proxies and should not be readable by unauthorized users.

## Remediation{% #remediation %}

### Shell script{% #shell-script %}

The following script can be run on the host to remediate the issue.

```bash
#!/bin/bash

find -P /etc/apt/auth.conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt  -type f -regextype posix-extended -regex '^.*\.conf$' -exec chmod u-xs,g-xws,o-xwrt {} \;
```

### Ansible playbook{% #ansible-playbook %}

The following playbook can be run with Ansible to remediate the issue.

```
- name: Find /etc/apt/auth.conf.d/ file(s)
  ansible.builtin.command: find -P /etc/apt/auth.conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt  -type
    f -regextype posix-extended -regex "^.*\.conf$"
  register: files_found
  changed_when: false
  failed_when: false
  check_mode: false
  tags:
  - configure_strategy
  - file_permissions_apt_auth_conf_d
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed

- name: Set permissions for /etc/apt/auth.conf.d/ file(s)
  ansible.builtin.file:
    path: '{{ item }}'
    mode: u-xs,g-xws,o-xwrt
    state: file
  with_items:
  - '{{ files_found.stdout_lines }}'
  tags:
  - configure_strategy
  - file_permissions_apt_auth_conf_d
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed
```
