---
title: Verify Permissions on /usr/share/keyrings Directory
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > Verify Permissions on
  /usr/share/keyrings Directory
---

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

# Verify Permissions on /usr/share/keyrings Directory
 
## Description{% #description %}

To properly set the permissions of `/usr/share/keyrings`, run the command:

```
$ sudo chmod 0755 /usr/share/keyrings
```

## Rationale{% #rationale %}

A non-root user should not be able to add or remove package repository keys from /usr/share/keyrings.

## Remediation{% #remediation %}

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

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

```bash
#!/bin/bash

find -H /usr/share/keyrings/ -maxdepth 0 -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \;
```

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

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

```
- name: Find /usr/share/keyrings/ file(s)
  ansible.builtin.command: 'find -P /usr/share/keyrings/ -maxdepth 0 -perm /u+s,g+ws,o+wt  -type
    d '
  register: files_found
  changed_when: false
  failed_when: false
  check_mode: false
  tags:
  - configure_strategy
  - directory_permissions_usr_share_keyrings
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed

- name: Set permissions for /usr/share/keyrings/ file(s)
  ansible.builtin.file:
    path: '{{ item }}'
    mode: u-s,g-ws,o-wt
    state: directory
  with_items:
  - '{{ files_found.stdout_lines }}'
  tags:
  - configure_strategy
  - directory_permissions_usr_share_keyrings
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed
```
